ansible/tasks/transient_cloud.yml

36 lines
1.6 KiB
YAML
Raw Normal View History

# New tasks to spin up instance in https://fed-cloud09.cloud.fedoraproject.org
- name: spin UP VM using nova_compute
sudo: False
local_action:
security_groups: all-icmp-transient,web-80-anywhere-transient,web-443-anywhere-transient,ssh-anywhere-transient,default
nics:
- net-id: "28db7265-fb78-4937-bfe3-9c8a9b959c30"
name: "{{ name }}"
module: nova_compute
auth_url: "{{os_auth_url}}"
login_username: "admin"
login_password: "{{ADMIN_PASS}}"
login_tenant_name: transient
image_id: "{{ image|image_name_to_id('admin', ADMIN_PASS, 'transient', os_auth_url) }}"
wait_for: 300
flavor_id: "{{ instance_type|flavor_name_to_id('admin', ADMIN_PASS, 'transient', os_auth_url) }}"
key_name: fedora-admin-20130801
auto_floating_ip: true
user_data: "#cloud-config\ndisable_root: 0"
register: nova_result
- name: add it to the special group
local_action: add_host hostname="{{ nova_result.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="{{ nova_result.public_ip }}" msg="transient cloud instance created on {{ nova_result.public_ip }}\n name = {{ name }}\nroot_uath_users = {{ root_auth_users }}\nimage = {{ image }}"
- name: wait for he host to be hot
local_action: wait_for host={{ nova_result.public_ip }} port=22 delay=1 timeout=600
# 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