First untested cut at a temp/transient cloud playbook for new cloud.

This commit is contained in:
Kevin Fenzi 2015-05-13 20:34:50 +00:00
parent 81d27bc89b
commit f849e48611
2 changed files with 113 additions and 0 deletions

View file

@ -0,0 +1,43 @@
# New tasks to spin up instance in https://fed-cloud09.cloud.fedoraproject.org
- name: check it out
local_action: shell nc -d -z -w 5 {{ inventory_hostname }} 22 >>/dev/null
register: host_is_up
ignore_errors: true
- name: spin UP VM using nova_compute
sudo: False
local_action:
module: nova_compute
auth_url: "{{os_auth_url}}"
login_username: "admin"
login_password: "{{ADMIN_PASS}}"
login_tenant_name: "{{inventory_tenant}}"
name: "{{inventory_instance_name}}"
image_id: "{{ image|image_name_to_id('admin', ADMIN_PASS, inventory_tenant, os_auth_url) }}"
wait_for: 300
flavor_id: "{{ instance_type|flavor_name_to_id('admin', ADMIN_PASS, inventory_tenant, os_auth_url) }}"
security_groups: "{{security_group}}"
key_name: "{{ keypair }}"
nics: "{{ cloud_networks }}"
floating_ips:
- "{{public_ip}}"
register: nova_result
when: host_is_up|failed
- name: add it to the special group
local_action: add_host hostname=public_ip groupname=tmp_just_created
#- name: mail off about where it is
# local_action: mail to=sysadmin-main-members@fedoraproject.org from=ansible-create@fedoraproject.org subject={{ public_ip }} msg="cloud instance created on {{ public_ip }}\n {{ hostbase }} {{ root_auth_users }} "
#
- name: wait for he host to be hot
local_action: wait_for host={{ public_ip }} port=22 delay=1 timeout=600
when: host_is_up|failed
# SSH is up and running, however cloud-init still did not deployed ssh keypair
# we have to wait some time. 10 sec is usually enough, but not always.
- name: waiting for cloud-init
pause: seconds=30
when: host_is_up|failed