trying nova cli instead of nova_compute ansible module

This commit is contained in:
Valentin Gologuzov 2015-03-16 14:50:13 +01:00
parent c1f0e72da3
commit 662bac2120

View file

@ -8,36 +8,38 @@
# OS_TENANT_ID # OS_TENANT_ID
# OS_TENANT_NAME # OS_TENANT_NAME
- debug: msg="Auth {{OS_AUTH_URL}} {{OS_TENANT_NAME}} {{OS_USERNAME}}"
# To use direct `nova` commands construct _OS_AUTH_OPTS as: # To use direct `nova` commands construct _OS_AUTH_OPTS as:
# --os-auth-url {{OS_AUTH_URL}} --os-username {{OS_USERNAME}} --os-password {{OS_PASSWORD}} --os-tenant-name {{OS_TENANT_NAME}} --os-tenant-id {{OS_TENANT_ID}} # --os-auth-url {{OS_AUTH_URL}} --os-username {{OS_USERNAME}} --os-password {{OS_PASSWORD}} --os-tenant-name {{OS_TENANT_NAME}} --os-tenant-id {{OS_TENANT_ID}}
#- name: get current VM status - name: get current VM status
# local_action: "shell nova --insecure {{_OS_AUTH_OPTS}} show {{inventory_hostname}} 2>/dev/null | grep status | cut -d'|' -f3 | cut -d' ' -f2" local_action: "shell nova --insecure {{_OS_AUTH_OPTS}} show {{inventory_hostname}} 2>/dev/null | grep status | cut -d'|' -f3 | cut -d' ' -f2"
# register: vm_status register: vm_status
#- name: spinup VM: without novaclient, need to set key-pair and floating ip later
# local_action: "shell nova --insecure {{_OS_AUTH_OPTS}} boot --flavor {{flavor_id}} --image {{image}} --poll {{inventory_hostname}}"
# when: vm_status.stdout != "ACTIVE"
- debug: msg="Auth {{OS_AUTH_URL}} {{OS_TENANT_NAME}} {{OS_USERNAME}}" - name: spinup VM: without novaclient, need to set key-pair and floating ip later
local_action: "shell nova --insecure {{_OS_AUTH_OPTS}} boot --flavor {{flavor_id}} --image {{image}} --poll {{inventory_hostname}}"
when: vm_status.stdout != "ACTIVE"
- name: spin UP VM using nova_compute
delegate_to: 127.0.0.1
nova_compute: #- name: spin UP VM using nova_compute
# insecure: True # delegate_to: 127.0.0.1
auth_url: "{{OS_AUTH_URL}}" # nova_compute:
login_username: "{{OS_USERNAME}}" # # insecure: True
login_password: "{{OS_PASSWORD}}" # auth_url: "{{OS_AUTH_URL}}"
login_tenant_name: "{{OS_TENANT_NAME}}" # login_username: "{{OS_USERNAME}}"
name: "{{inventory_hostname}}" # login_password: "{{OS_PASSWORD}}"
image_id: "{{ image }}" # login_tenant_name: "{{OS_TENANT_NAME}}"
wait_for: 300 # name: "{{inventory_hostname}}"
flavor_id: "{{ flavor_id }}" # TODO: conversion from `instance_type` # image_id: "{{ image }}"
security_groups: "{{security_group}}" # wait_for: 300
key_name: "{{ keypair }}" # flavor_id: "{{ flavor_id }}" # TODO: conversion from `instance_type`
floating_ips: # security_groups: "{{security_group}}"
- "{{public_ip}}" # key_name: "{{ keypair }}"
register: nova_result # floating_ips:
# when: vm_status.stdout != "ACTIVE" # - "{{public_ip}}"
# register: nova_result
# # when: vm_status.stdout != "ACTIVE"
# - debug: msg="{{ nova_result.info }}" # - debug: msg="{{ nova_result.info }}"