Fallback to public IPv4 when there is no priv. IP
Similarly to I139272746129213994f298a4a9178b4441d439af and I32fb17bae98f13f735da4d5b9a6a01e948f21678, fallback to public IPv4, when populating the nodepool files important to be set up for the pre-deployment zuul stages. In particular, this allows the multi-node CI reproducer with static/libvirt nodepool provider to always have the overcloud group defined, even if it consists of subnodes running with a single IP. Change-Id: I4eabef8b1d7a20d8474c70091960c8001c3a746a Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
This commit is contained in:
parent
150c29e0f4
commit
85f7e64373
|
@ -1,6 +1,18 @@
|
|||
- hosts: all
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Set IP addresses for the nodes missing private IPs
|
||||
set_fact:
|
||||
nodepool_ip: "{{ nodepool.public_ipv4 }}"
|
||||
when: not (nodepool.private_ipv4 | ipv4)
|
||||
|
||||
- name: Set IP addresses for the nodes without private IPs (a fallback)
|
||||
set_fact:
|
||||
nodepool_ip: "{{ nodepool.private_ipv4 | default(nodepool.public_ipv4) }}"
|
||||
when: nodepool_ip is not defined
|
||||
|
||||
- hosts: all
|
||||
tasks:
|
||||
|
||||
- name: Create nodepool directory
|
||||
file:
|
||||
path: /etc/nodepool
|
||||
|
@ -26,7 +38,7 @@
|
|||
- name: Populate nodepool sub_nodes_private file
|
||||
lineinfile:
|
||||
path: /etc/nodepool/sub_nodes_private
|
||||
line: "{{ hostvars[item]['nodepool']['private_ipv4'] }}"
|
||||
line: "{{ hostvars[item]['nodepool_ip'] }}"
|
||||
insertafter: EOF
|
||||
with_items: "{{ groups['subnodes'] }}"
|
||||
when: groups['subnodes'] is defined
|
||||
|
@ -34,13 +46,13 @@
|
|||
- name: Create nodepool primary file
|
||||
copy:
|
||||
dest: /etc/nodepool/primary_node_private
|
||||
content: "{{ hostvars['primary']['nodepool']['private_ipv4'] }}"
|
||||
content: "{{ hostvars['primary']['nodepool_ip'] }}"
|
||||
when: hostvars['primary'] is defined
|
||||
|
||||
- name: Create nodepool node_private for this node
|
||||
copy:
|
||||
dest: /etc/nodepool/node_private
|
||||
content: "{{ nodepool.private_ipv4 }}"
|
||||
content: "{{ nodepool_ip }}"
|
||||
|
||||
- name: Copy ssh keys to nodepool directory
|
||||
command: "cp .ssh/{{ item }} /etc/nodepool/{{ item }}"
|
||||
|
|
Loading…
Reference in New Issue