Skip to content

Commit 3a184c6

Browse files
committed
Support routers without an external gateway
Sometimes we may want to create routers that do not have an external gateway. This was possible before the router workaround was applied in 0ed105f. This change makes it possible to define a router without a 'network' attribute.
1 parent d3b6b63 commit 3a184c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

roles/os_networks/tasks/router_workaround.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
cloud: "{{ os_networks_cloud | default(omit) }}"
1717
interface: "{{ os_networks_interface | default(omit, true) }}"
1818
register: _networks_query
19+
when: item.network is defined
1920

2021
- name: Ensure router is registered with neutron
2122
openstack.cloud.router:
@@ -26,7 +27,7 @@
2627
interface: "{{ os_networks_interface | default(omit, true) }}"
2728
name: "{{ item.name }}"
2829
interfaces: "{{ item.interfaces | default(omit) }}"
29-
network: "{{ _networks_query.networks[0].id }}"
30+
network: "{{ _networks_query.networks[0].id if _networks_query is not skipped else omit }}"
3031
external_fixed_ips: "{{ item.external_fixed_ips | default(omit) }}"
3132
project: "{{ item.project | default(omit) }}"
3233
state: "{{ item.state | default(omit) }}"

0 commit comments

Comments
 (0)