aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Wieczorek <p.wieczorek2@samsung.com>2021-01-29 11:30:18 +0100
committerPawel Wieczorek <p.wieczorek2@samsung.com>2021-01-29 11:30:22 +0100
commiteac6b77fc46b0204a7f88ddd75e6f5df30356006 (patch)
tree7b2be62588f51a91585cf1748b7e1b504a9d67c8
parentcda6d6036449f37692b7ff6be571dd335689732b (diff)
Inject operator key when launching cluster instances
Issue-ID: INT-1601 Change-Id: Ie2c606d7afa191386124a0ad49619de40fb15c06 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
-rw-r--r--deployment/noheat/infra-openstack/ansible/create.yml22
-rw-r--r--deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/create_host.yml4
2 files changed, 13 insertions, 13 deletions
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