From 8fef92cf3042f914ed74b7bfa150ac6a072c5079 Mon Sep 17 00:00:00 2001 From: Rick Elrod Date: Fri, 13 Jul 2018 22:01:00 +0000 Subject: [PATCH] use the right variables for os_server registered vars, and uncomment some things Signed-off-by: Rick Elrod --- tasks/transient_newcloud.yml | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tasks/transient_newcloud.yml b/tasks/transient_newcloud.yml index 5ee54ae0f9..3c2a86f906 100644 --- a/tasks/transient_newcloud.yml +++ b/tasks/transient_newcloud.yml @@ -16,35 +16,35 @@ key_name: fedora-admin-20130801 auto_floating_ip: true userdata: "#cloud-config\ndisable_root: 0" - register: nova_result + register: instance - name: add it to the special group - local_action: add_host hostname="{{ nova_result.public_ip }}" groupname=tmp_just_created + local_action: add_host hostname="{{ instance.server.accessIPv4 }}" 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 }}" -# body="transient cloud instance created on {{ nova_result.public_ip }} -# name = {{ name }} -# root_auth_users = {{ root_auth_users }} -# image = {{ image }}" +- name: mail off about where it is + local_action: mail + to=codeblock@fedoraproject.org + from=ansible-create@fedoraproject.org + subject="{{ instance.server.accessIPv4 }}" + body="transient cloud instance created on {{ instance.server.accessIPv4 }} + name = {{ name }} + root_auth_users = {{ root_auth_users }} + image = {{ image }}" - name: wait for he host to be hot - local_action: wait_for host={{ nova_result.public_ip }} port=22 delay=1 timeout=600 + local_action: wait_for host={{ instance.server.accessIPv4 }} port=22 delay=1 timeout=600 -#- name: gather ssh host key from new instance -# local_action: command ssh-keyscan -t rsa {{ nova_result.public_ip }} -# ignore_errors: True -# register: hostkey +- name: gather ssh host key from new instance + local_action: command ssh-keyscan -t rsa {{ instance.server.accessIPv4 }} + ignore_errors: True + register: hostkey -#- name: add new ssh host key (you still need to add it to official ssh_host_keys later) -# local_action: known_hosts path={{item}} key="{{ hostkey.stdout }}" host={{ nova_result.public_ip }} state=present -# ignore_errors: True -# with_items: -# - /root/.ssh/known_hosts -# - /etc/ssh/ssh_known_hosts +- name: add new ssh host key (you still need to add it to official ssh_host_keys later) + local_action: known_hosts path={{item}} key="{{ hostkey.stdout }}" host={{ instance.server.accessIPv4 }} state=present + ignore_errors: True + with_items: + - /root/.ssh/known_hosts + - /etc/ssh/ssh_known_hosts # 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.