commit 668ff84cdd8253bb2a11cbe377bc35d226dd1a7a
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Wed Jul 31 15:02:05 2019 +0200
Sync tasks
tasks/osbs_koji_token.yml | 11 +++++++++
tasks/transient_newcloud.yml | 52 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/tasks/osbs_koji_token.yml b/tasks/osbs_koji_token.yml
new file mode 100644
index 0000000..f219337
--- /dev/null
+++ b/tasks/osbs_koji_token.yml
@@ -0,0 +1,11 @@
+---
+
+- name: make sure that /etc/osbs directory exists
+ file: path=/etc/osbs state=directory
+
+- name: put the koji token file in place
+ copy:
+ src: "{{ private }}/files/osbs/{{ env }}/x86-64-osbs-koji"
+ dest: "/etc/osbs/x86-64-osbs-koji"
+ owner: root
+ mode: 0400
diff --git a/tasks/transient_newcloud.yml b/tasks/transient_newcloud.yml
new file mode 100644
index 0000000..3c2a86f
--- /dev/null
+++ b/tasks/transient_newcloud.yml
@@ -0,0 +1,52 @@
+- name: spin UP VM using os_server
+ delegate_to:
undercloud01.cloud.fedoraproject.org
+ os_server:
+ state: present
+ security_groups: default
+ nics:
+ - net-id: d18c60b1-bba2-416f-87c3-a4416191bd7c
+ name: "{{ name }}"
+ auth:
+ auth_url:
http://172.23.1.52:5000/v2.0
+ username: "admin"
+ password: "{{newcloud_os_admin_pw}}"
+ project_name: relrod-super-cool-test-project
+ image: fedora-28-cloud-test
+ flavor: test.flavor.blah
+ key_name: fedora-admin-20130801
+ auto_floating_ip: true
+ userdata: "#cloud-config\ndisable_root: 0"
+ register: instance
+
+- name: add it to the special group
+ local_action: add_host hostname="{{ instance.server.accessIPv4 }}"
groupname=tmp_just_created
+
+- name: mail off about where it is
+ local_action: mail
+ to=codeblock(a)fedoraproject.org
+ from=ansible-create(a)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={{ instance.server.accessIPv4 }} port=22 delay=1
timeout=600
+
+- 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={{
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.
+- name: waiting for cloud-init
+ pause: seconds=30