Ensure that lb-mgmt-subnet has a gateway in Octavia DCN

The lb-mgmt-subnet is added to a router but Neutron requires that the
subnet has a non-empty gateway.
Ensure it exists before adding it.

wallaby-backport-potential

Change-Id: I1e01880449bd2fc08da949dc409e4089fe2f6e0d
(cherry picked from commit eaf63ff01f)
This commit is contained in:
Gregory Thiemonge 2023-03-06 10:20:08 +01:00
parent 606f75163d
commit 0e81d400ec
1 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,22 @@
changed_when: "'created_at' in result.stdout"
loop: "{{ ['backbone'] | union(octavia_availability_zones | list) }}"
- name: Get main lb-mgmt subnet
shell: |
openstack subnet show -f json {{ subnet_name }}
vars:
subnet_name: "{{ lb_mgmt_prefix }}-subnet"
register: subnet_output
- name: Ensure that lb-mgmt-subnet has a gateway
shell: |
openstack subnet set --gateway {{ subnet.cidr | ipaddr('next_usable') }} {{ subnet_name }}
vars:
subnet_name: "{{ lb_mgmt_prefix }}-subnet"
subnet: "{{ subnet_output.stdout | from_json }}"
when:
- subnet.gateway_ip == None
- name: Create lb-mgmt routers
shell: |
if ! openstack router show {{ router_name }} > /dev/null 2>&1; then