Default private_ipv4 to use public_ipv4 address when null
The static zuul driver returns only a public_ipv4 address for nodes in use. The multinode bridge role accesses the node private_ipv4 address. As such, when the private address is empty/null the role fails. This review defaults that private address so that the role uses the public address when the private address is null. Change-Id: I32fb17bae98f13f735da4d5b9a6a01e948f21678
This commit is contained in:
parent
0d50b773bd
commit
9853d3608f
@ -9,19 +9,30 @@
|
|||||||
vni: "{{ offset | int + bridge_vni_offset | int }}"
|
vni: "{{ offset | int + bridge_vni_offset | int }}"
|
||||||
|
|
||||||
# To make things more readable in the following tasks
|
# To make things more readable in the following tasks
|
||||||
|
- name: Set ip address when the node private IP is not set
|
||||||
|
set_fact:
|
||||||
|
nodepool_ip: |
|
||||||
|
{{ nodepool.private_ipv4 | default(nodepool.public_ipv4) }}
|
||||||
|
|
||||||
|
- name: Select the switch from group
|
||||||
|
set_fact:
|
||||||
|
switch: "{{ groups['switch'][0] }}"
|
||||||
|
|
||||||
- name: Alias the primary node private IP
|
- name: Alias the primary node private IP
|
||||||
set_fact:
|
set_fact:
|
||||||
switch_private_ip: "{{ hostvars[groups['switch'][0]]['nodepool']['private_ipv4'] }}"
|
switch_ip: |
|
||||||
|
{{ hostvars[switch].nodepool.private_ipv4 |
|
||||||
|
default(hostvars[switch].nodepool.public_ipv4) }}
|
||||||
|
|
||||||
- name: Add port to bridge on switch node
|
- name: Add port to bridge on switch node
|
||||||
become: yes
|
become: yes
|
||||||
command: >-
|
command: >-
|
||||||
ovs-vsctl --may-exist add-port {{ bridge_name }}
|
ovs-vsctl --may-exist add-port {{ bridge_name }}
|
||||||
{{ bridge_name }}_{{ nodepool['private_ipv4'] }}
|
{{ bridge_name }}_{{ nodepool_ip }}
|
||||||
-- set interface {{ bridge_name }}_{{ nodepool['private_ipv4'] }}
|
-- set interface {{ bridge_name }}_{{ nodepool_ip}}
|
||||||
type=vxlan options:remote_ip={{ nodepool['private_ipv4'] }} options:key={{ vni }}
|
type=vxlan options:remote_ip={{ nodepool_ip }} options:key={{ vni }}
|
||||||
options:local_ip={{ switch_private_ip }}
|
options:local_ip={{ switch_ip }}
|
||||||
delegate_to: "{{ groups['switch'][0] }}"
|
delegate_to: "{{ switch }}"
|
||||||
|
|
||||||
- name: Create bridge on peer node
|
- name: Create bridge on peer node
|
||||||
become: yes
|
become: yes
|
||||||
@ -36,10 +47,10 @@
|
|||||||
become: yes
|
become: yes
|
||||||
command: >-
|
command: >-
|
||||||
ovs-vsctl --may-exist add-port {{ bridge_name }}
|
ovs-vsctl --may-exist add-port {{ bridge_name }}
|
||||||
{{ bridge_name }}_{{ switch_private_ip }}
|
{{ bridge_name }}_{{ switch_ip }}
|
||||||
-- set interface {{ bridge_name }}_{{ switch_private_ip }}
|
-- set interface {{ bridge_name }}_{{ switch_ip }}
|
||||||
type=vxlan options:remote_ip={{ switch_private_ip }} options:key={{ vni }}
|
type=vxlan options:remote_ip={{ switch_ip }} options:key={{ vni }}
|
||||||
options:local_ip={{ nodepool['private_ipv4'] }}
|
options:local_ip={{ nodepool_ip }}
|
||||||
|
|
||||||
- when: bridge_configure_address
|
- when: bridge_configure_address
|
||||||
block:
|
block:
|
||||||
|
Loading…
Reference in New Issue
Block a user