From f7dd723294912e4bb4484859ac263ab9270d70c6 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Thu, 24 Dec 2020 09:42:55 +0100
Subject: Allow operator access to the cluster
This patch creates operator keypair and deploys its public key to all
machines in the cluster. Previously cluster could be accessed from
OpenStack admin machine only.
Additional information added to the "all.yml*" group variables allowed
keeping current roles generic and flexible.
Issue-ID: INT-1601
Change-Id: I6b289ff9a8c9ebe04562671b8f4b4468b543723f
Signed-off-by: Pawel Wieczorek
---
.../openstack/create_devstack_hosts/tasks/create_host.yml | 10 ++++++++++
.../roles/openstack/create_devstack_hosts/tasks/main.yml | 2 +-
.../roles/openstack/destroy_devstack_hosts/tasks/main.yml | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
(limited to 'deployment/noheat/infra-openstack/ansible/roles')
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 2a78e82e3..7fed57859 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,3 +13,13 @@
boot_from_volume: true
terminate_volume: true
volume_size: "{{ host.volume_size | default(10) }}"
+ register: new_host
+
+- name: Add host to inventory
+ add_host:
+ hostname: "{{ new_host.server.name }}"
+ groups: "{{ cluster.name }}"
+ ansible_ssh_host: "{{ new_host.server.public_v4 }}"
+ ansible_ssh_user: "{{ image.user }}"
+ ansible_ssh_extra_args: "-o StrictHostKeyChecking=no"
+ ansible_ssh_private_key_file: "~/.ssh/{{ keypair.key.name }}"
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/main.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/main.yml
index 731bca04f..f8a64cbef 100644
--- a/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/main.yml
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/main.yml
@@ -1,3 +1,3 @@
---
- include: create_host.yml host={{ item }}
- loop: "{{ hosts }}"
+ loop: "{{ cluster.hosts }}"
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_hosts/tasks/main.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_hosts/tasks/main.yml
index 5ce130d44..a27e6a27b 100644
--- a/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_hosts/tasks/main.yml
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_hosts/tasks/main.yml
@@ -1,3 +1,3 @@
---
- include: destroy_host.yml host={{ item }}
- loop: "{{ hosts }}"
+ loop: "{{ cluster.hosts }}"
--
cgit 1.2.3-korg