diff --git a/inventory/host_vars/buildhw-a64-01.iad2.fedoraproject.org b/inventory/host_vars/buildhw-a64-01.iad2.fedoraproject.org index 8a88c96a45..47532ede18 100644 --- a/inventory/host_vars/buildhw-a64-01.iad2.fedoraproject.org +++ b/inventory/host_vars/buildhw-a64-01.iad2.fedoraproject.org @@ -3,3 +3,26 @@ gw: 10.3.170.254 eth1_ip: 10.3.170.121 eth1_ipv4_gw: 10.3.170.254 datacenter: iad2 + +network_connections: + - name: eth0 + state: down + type: ethernet + - name: eth1 + state: up + type: ethernet + autoconnect: yes + ip: + address: 10.3.170.121/24 + gateway4: 10.3.170.254 + dns: + - 10.3.163.33 + - 10.3.163.34 + dns_search: + - iad2.fedoraproject.org + - fedoraproject.org + dhcp4: no + auto6: no + - name: eth2 + state: down + type: ethernet diff --git a/roles/base/meta/main.yml b/roles/base/meta/main.yml index 8fc4b3b56f..316aceb00e 100644 --- a/roles/base/meta/main.yml +++ b/roles/base/meta/main.yml @@ -1,5 +1,6 @@ --- dependencies: + - { role: linux-system-roles.network, when: network_connections is defined } - { role: basessh } - { role: chrony } - { role: dnf-automatic } diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 24d4f59c23..97f00b0fd5 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -29,7 +29,7 @@ # XXX fixme # a datacenter 'fact' from setup - name: /etc/resolv.conf copy: src={{ item }} dest=/etc/resolv.conf - when: not nm_controlled_resolv + when: not nm_controlled_resolv or not network_connections is defined with_first_found: - "{{ resolvconf }}" - resolv.conf/{{ inventory_hostname }} @@ -59,7 +59,7 @@ ini_file: dest=/etc/NetworkManager/NetworkManager.conf section=main option=dns value=none notify: - restart NetworkManager - when: ansible_distribution_major_version|int >=7 and ansible_distribution == 'RedHat' and nmclitest is success and ( not ansible_ifcfg_blocklist) and not nm_controlled_resolv + when: ansible_distribution_major_version|int >=7 and ansible_distribution == 'RedHat' and nmclitest is success and ( not ansible_ifcfg_blocklist) and not nm_controlled_resolv and ( not network_connections is defined ) tags: - config - resolvconf @@ -70,7 +70,7 @@ ini_file: dest=/etc/NetworkManager/NetworkManager.conf section=main option=dns value=none notify: - restart NetworkManager - when: ansible_distribution_major_version|int >=29 and ansible_distribution == 'Fedora' and nmclitest is success and ( not ansible_ifcfg_blocklist) and not nm_controlled_resolv + when: ansible_distribution_major_version|int >=29 and ansible_distribution == 'Fedora' and nmclitest is success and ( not ansible_ifcfg_blocklist) and not nm_controlled_resolv and ( not network_connections is defined ) tags: - config - resolvconf @@ -106,6 +106,7 @@ - nmclitest is success - not ansible_ifcfg_blocklist - ansible_ifcfg_allowlist is not defined or item in ansible_ifcfg_allowlist + - not network_connections is defined tags: - config - ifcfg