Browse Source

infrastructure: do not override network_{primary,secondary}_interface

keep-around/125f571293c4d1652f4129100af4b8bb983d6f80
Loïc Dachary 4 months ago
parent
commit
d235c26a98
Signed by: dachary GPG Key ID: 992D23B392F9E4F2
  1. 4
      inventory/group_vars/all/network.yml
  2. 4
      inventory/group_vars/all/openstack.yml
  3. 11
      tests/__init__.py

4
inventory/group_vars/all/network.yml

@ -15,8 +15,8 @@
# the default route is network_secondary_interface
#
network_internal_only: false
network_primary_interface: "{{ infrastructure_driver == 'openstack' | ternary('eth0', 'enp1s0') }}"
network_secondary_interface: "{{ infrastructure_driver == 'openstack' | ternary('eth1', 'enp2s0') }}"
network_primary_interface: "{{ (infrastructure_driver == 'openstack') | ternary(openstack_network_primary_interface, 'enp1s0') }}"
network_secondary_interface: "{{ (infrastructure_driver == 'openstack') | ternary(openstack_network_secondary_interface, 'enp2s0') }}"
#
# Only one of the two interfaces is routed
#

4
inventory/group_vars/all/openstack.yml

@ -37,5 +37,5 @@ openstack_flavor_large: "{{ openstack_providers[_provider].flavors.large }}"
openstack_flavor: '{{ openstack_flavor_small }}'
openstack_image: "{{ openstack_providers[_provider].image }}"
openstack_network: "{{ openstack_providers[_provider].network }}"
network_primary_interface: "{{ openstack_providers[_provider].network_primary_interface }}"
network_secondary_interface: "{{ openstack_providers[_provider].network_secondary_interface }}"
openstack_network_primary_interface: "{{ openstack_providers[_provider].network_primary_interface }}"
openstack_network_secondary_interface: "{{ openstack_providers[_provider].network_secondary_interface }}"

11
tests/__init__.py

@ -134,20 +134,9 @@ class InfrastructureLibvirt(Infrastructure):
---
certificate_authority: ownca
"""))
#
# The network_ variables are required because inventory/group_vars/all/network.yml
# will **not** be re-evaluated when infrastructure_driver is modified in a
# **different** inventory, i.e. the one we're creating here to override values
# for testing purposes
#
open(f'{self.all_dir}/infrastructure.yml', 'w').write(textwrap.dedent("""\
---
infrastructure_driver: libvirt
network_primary_interface: enp1s0
network_secondary_interface: enp2s0
network_interface_unconfigured: noname
network_interface_routed: "{{ network_primary_interface }}"
network_interface_not_routed: "{{ network_secondary_interface }}"
"""))
def config_dir_set(self, enough_dot_dir):

Loading…
Cancel
Save