From eac6b77fc46b0204a7f88ddd75e6f5df30356006 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Fri, 29 Jan 2021 11:30:18 +0100
Subject: Inject operator key when launching cluster instances
Issue-ID: INT-1601
Change-Id: Ie2c606d7afa191386124a0ad49619de40fb15c06
Signed-off-by: Pawel Wieczorek
---
.../noheat/infra-openstack/ansible/create.yml | 22 +++++++++-------------
.../create_devstack_hosts/tasks/create_host.yml | 4 ++++
2 files changed, 13 insertions(+), 13 deletions(-)
(limited to 'deployment')
diff --git a/deployment/noheat/infra-openstack/ansible/create.yml b/deployment/noheat/infra-openstack/ansible/create.yml
index 74d6d1f44..6adcf5f65 100644
--- a/deployment/noheat/infra-openstack/ansible/create.yml
+++ b/deployment/noheat/infra-openstack/ansible/create.yml
@@ -1,5 +1,5 @@
---
-- name: Create infrastructure
+- name: Prepare infrastructure and create operation instances
hosts: localhost
connection: local
gather_facts: False
@@ -9,8 +9,7 @@
- openstack/create_devstack_keypair
- role: openstack/create_devstack_hosts
hosts: "{{ operation.hosts }}"
- - role: openstack/create_devstack_hosts
- hosts: "{{ cluster.hosts }}"
+ operator_key: "dummy"
- name: Create cluster operator access keypair
hosts: "operator0"
gather_facts: False
@@ -21,14 +20,11 @@
community.crypto.openssh_keypair:
path: "~/.ssh/{{ keypair.name }}"
register: key
-- name: Deploy cluster operator public key
- hosts: "cluster0"
+- name: Create cluster instances
+ hosts: localhost
+ connection: local
gather_facts: False
- tasks:
- - name: Wait for system to become reachable
- wait_for_connection:
- - name: Add authorized key
- ansible.posix.authorized_key:
- user: "{{ image.user }}"
- state: present
- key: "{{ hostvars['operator0']['key']['public_key'] }}"
+ roles:
+ - role: openstack/create_devstack_hosts
+ hosts: "{{ cluster.hosts }}"
+ operator_key: "{{ hostvars['operator0']['key']['public_key'] }}"
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/create_host.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/create_host.yml
index 7fed57859..c3b40d29d 100644
--- a/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/create_host.yml
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/create_host.yml
@@ -13,6 +13,10 @@
boot_from_volume: true
terminate_volume: true
volume_size: "{{ host.volume_size | default(10) }}"
+ userdata: |
+ #cloud-config
+ ssh_authorized_keys:
+ - "{{ operator_key }}"
register: new_host
- name: Add host to inventory
--
cgit 1.2.3-korg