aboutsummaryrefslogtreecommitdiffstats
path: root/deployment
diff options
context:
space:
mode:
authorPawel Wieczorek <p.wieczorek2@samsung.com>2021-01-29 14:19:40 +0100
committerPawel Wieczorek <p.wieczorek2@samsung.com>2021-01-29 14:19:43 +0100
commita4e91199e71aafff55120ebb9ebef1826d741db8 (patch)
tree30f47203553e4c8f8d37a76d8cafad03a6a1e636 /deployment
parenteac6b77fc46b0204a7f88ddd75e6f5df30356006 (diff)
Create cluster operator access information
Issue-ID: INT-1601 Change-Id: I218ec5521d97eab298ea0556f690f2bc3d8ccbfa Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Diffstat (limited to 'deployment')
-rw-r--r--deployment/noheat/infra-openstack/ansible/create.yml10
-rw-r--r--deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/create_host.yml4
2 files changed, 14 insertions, 0 deletions
diff --git a/deployment/noheat/infra-openstack/ansible/create.yml b/deployment/noheat/infra-openstack/ansible/create.yml
index 6adcf5f65..5b9542195 100644
--- a/deployment/noheat/infra-openstack/ansible/create.yml
+++ b/deployment/noheat/infra-openstack/ansible/create.yml
@@ -28,3 +28,13 @@
- role: openstack/create_devstack_hosts
hosts: "{{ cluster.hosts }}"
operator_key: "{{ hostvars['operator0']['key']['public_key'] }}"
+- name: Create cluster operator access information
+ hosts: "operator0"
+ gather_facts: False
+ tasks:
+ - name: Add cluster hostnames to /etc/hosts file
+ lineinfile:
+ path: /etc/hosts
+ line: "{{ item.value + ' ' + item.key }}"
+ become: yes
+ loop: "{{ lookup('dict', hostvars['localhost']['hosts_dict']) }}"
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 c3b40d29d..c217abaa9 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
@@ -27,3 +27,7 @@
ansible_ssh_user: "{{ image.user }}"
ansible_ssh_extra_args: "-o StrictHostKeyChecking=no"
ansible_ssh_private_key_file: "~/.ssh/{{ keypair.key.name }}"
+
+- name: Add host to hosts dict
+ set_fact:
+ hosts_dict: "{{ hosts_dict|default({}) | combine( {new_host.server.name: new_host.server.private_v4} ) }}"