From 5aaa41c9c4e1e25f6591dbdc73360816d6a8e3ea Mon Sep 17 00:00:00 2001 From: Jakob Meng Date: Wed, 11 Jan 2023 15:48:21 +0100 Subject: [PATCH] Inlined network_external variable Change-Id: I4cbbd84eaed99dae40c72fbdf567b480a1f268a4 --- ci/roles/network/defaults/main.yml | 1 - ci/roles/network/tasks/main.yml | 12 ++++---- ci/roles/neutron_rbac_policy/tasks/main.yml | 2 +- ci/roles/port/defaults/main.yml | 1 - ci/roles/port/tasks/main.yml | 2 +- ci/roles/router/defaults/main.yml | 1 - ci/roles/router/tasks/main.yml | 34 +-------------------- 7 files changed, 9 insertions(+), 44 deletions(-) diff --git a/ci/roles/network/defaults/main.yml b/ci/roles/network/defaults/main.yml index 321ccd97..31131460 100644 --- a/ci/roles/network/defaults/main.yml +++ b/ci/roles/network/defaults/main.yml @@ -28,7 +28,6 @@ expected_fields: - updated_at dns_domain: example.opendev.org mtu: 1250 -network_external: false network_name: shade_network network_name_newparams: newparams_network network_name_updates: update_network diff --git a/ci/roles/network/tasks/main.yml b/ci/roles/network/tasks/main.yml index 32c4191f..f84debc8 100644 --- a/ci/roles/network/tasks/main.yml +++ b/ci/roles/network/tasks/main.yml @@ -5,7 +5,7 @@ name: "{{ network_name }}" state: present shared: "{{ network_shared }}" - external: "{{ network_external }}" + external: false register: infonet - name: Check output of creating network @@ -58,7 +58,7 @@ - "'is_shared' in result.networks.0" - result.networks.0['is_shared']|lower == network_shared|lower - "'is_router_external' in result.networks.0" - - result.networks[0]['is_router_external'] == {{ network_external }} + - not (result.networks[0]['is_router_external'] | bool) - name: Create network - with new SDK params openstack.cloud.network: @@ -66,7 +66,7 @@ name: "{{ network_name_newparams }}" state: present shared: "{{ network_shared }}" - external: "{{ network_external }}" + external: false mtu: "{{ mtu }}" port_security_enabled: "{{ port_security_enabled }}" register: result_create_nw_with_new_params @@ -112,7 +112,7 @@ name: "{{ network_name_updates }}" state: present shared: "{{ network_shared }}" - external: "{{ network_external }}" + external: false mtu: "{{ mtu }}" port_security_enabled: "{{ port_security_enabled }}" register: result_create_nw_for_updates @@ -123,7 +123,7 @@ name: "{{ network_name_updates }}" state: present shared: "{{ network_shared }}" - external: "{{ network_external }}" + external: false mtu: "{{ mtu }}" port_security_enabled: "{{ port_security_enabled }}" # You cannot update this property. @@ -142,7 +142,7 @@ name: "{{ network_name_updates }}" state: present shared: "{{ network_shared }}" - external: "{{ network_external }}" + external: false # NOTE: This property should be updated mtu: "{{ mtu - 50 }}" # NOTE: This property should be updated diff --git a/ci/roles/neutron_rbac_policy/tasks/main.yml b/ci/roles/neutron_rbac_policy/tasks/main.yml index 1a39811d..290f03e2 100644 --- a/ci/roles/neutron_rbac_policy/tasks/main.yml +++ b/ci/roles/neutron_rbac_policy/tasks/main.yml @@ -16,7 +16,7 @@ state: present project: "{{ source_project.project.id }}" shared: false - external: "{{ network_external }}" + external: true register: network - name: Create target project diff --git a/ci/roles/port/defaults/main.yml b/ci/roles/port/defaults/main.yml index 08087993..a53a3649 100644 --- a/ci/roles/port/defaults/main.yml +++ b/ci/roles/port/defaults/main.yml @@ -39,7 +39,6 @@ expected_fields: - tenant_id - trunk_details - updated_at -network_external: true network_name: ansible_port_network no_security_groups: True port_name: ansible_port diff --git a/ci/roles/port/tasks/main.yml b/ci/roles/port/tasks/main.yml index 52a831ea..faef919b 100644 --- a/ci/roles/port/tasks/main.yml +++ b/ci/roles/port/tasks/main.yml @@ -4,7 +4,7 @@ cloud: "{{ cloud }}" state: present name: "{{ network_name }}" - external: "{{ network_external }}" + external: true register: network - name: Create subnet diff --git a/ci/roles/router/defaults/main.yml b/ci/roles/router/defaults/main.yml index fceb3955..00014421 100644 --- a/ci/roles/router/defaults/main.yml +++ b/ci/roles/router/defaults/main.yml @@ -19,7 +19,6 @@ expected_fields: - updated_at network_name: ansible_net external_network_name: ansible_external_net -network_external: true router_name: ansible_router test_subnets: - cloud: "{{ cloud }}" diff --git a/ci/roles/router/tasks/main.yml b/ci/roles/router/tasks/main.yml index 6d51e7ea..baa70ea9 100644 --- a/ci/roles/router/tasks/main.yml +++ b/ci/roles/router/tasks/main.yml @@ -331,9 +331,7 @@ cloud: "{{ cloud }}" state: present name: "{{ external_network_name }}" - external: "{{ network_external }}" - when: - - network_external + external: true - name: Create subnet5 openstack.cloud.subnet: @@ -342,8 +340,6 @@ network_name: "{{ external_network_name }}" name: shade_subnet5 cidr: 10.6.6.0/24 - when: - - network_external - name: Update router (add external gateway) openstack.cloud.router: @@ -353,8 +349,6 @@ network: "{{ external_network_name }}" interfaces: - shade_subnet1 - when: - - network_external - name: Gather routers info openstack.cloud.routers_info: @@ -392,8 +386,6 @@ external_fixed_ips: - subnet: shade_subnet5 ip: 10.6.6.100 - when: - - network_external - name: Gather routers info openstack.cloud.routers_info: @@ -409,8 +401,6 @@ - info.routers.0.name == router_name - (info.routers.0.external_gateway_info.external_fixed_ips|length) == 1 - info.routers.0.external_gateway_info.external_fixed_ips.0.ip_address == "10.6.6.100" - when: - - network_external - name: Update router (add external fixed ips) openstack.cloud.router: @@ -426,8 +416,6 @@ ip: 10.6.6.100 - subnet: shade_subnet5 ip: 10.6.6.101 - when: - - network_external - name: Update router (add external fixed ips) again openstack.cloud.router: @@ -442,8 +430,6 @@ ip: 10.6.6.100 - subnet: shade_subnet5 ip: 10.6.6.101 - when: - - network_external register: router - name: Assert idempotent module @@ -465,8 +451,6 @@ - (info.routers.0.external_gateway_info.external_fixed_ips|length) == 2 - info.routers.0.external_gateway_info.external_fixed_ips|map(attribute='ip_address')|sort|list == ["10.6.6.100", "10.6.6.101"] - when: - - network_external - name: Update router (remove external fixed ips) openstack.cloud.router: @@ -479,8 +463,6 @@ external_fixed_ips: - subnet: shade_subnet5 ip: 10.6.6.101 - when: - - network_external - name: Update router (remove external fixed ips) again openstack.cloud.router: @@ -493,8 +475,6 @@ external_fixed_ips: - subnet: shade_subnet5 ip: 10.6.6.101 - when: - - network_external register: router - name: Assert idempotent module @@ -515,8 +495,6 @@ - info.routers.0.name == router_name - (info.routers.0.external_gateway_info.external_fixed_ips|length) == 1 - info.routers.0.external_gateway_info.external_fixed_ips.0.ip_address == "10.6.6.101" - when: - - network_external - name: Update router (disable external snat) openstack.cloud.router: @@ -530,8 +508,6 @@ external_fixed_ips: - subnet: shade_subnet5 ip: 10.6.6.101 - when: - - network_external - name: Gather routers info openstack.cloud.routers_info: @@ -546,8 +522,6 @@ that: - info.routers.0.name == router_name - not info.routers.0.external_gateway_info.enable_snat - when: - - network_external - name: Update router (disable external snat) again openstack.cloud.router: @@ -561,8 +535,6 @@ external_fixed_ips: - subnet: shade_subnet5 ip: 10.6.6.101 - when: - - network_external register: router - name: Assert idempotent module @@ -727,8 +699,6 @@ cloud: "{{ cloud }}" state: absent name: shade_subnet5 - when: - - network_external - name: Delete subnets 1-4 openstack.cloud.subnet: @@ -748,7 +718,5 @@ cloud: "{{ cloud }}" state: absent name: "{{ external_network_name }}" - when: - - network_external - include_tasks: shared_network.yml