base: use linux system roles network role for hosts that define network_connections
This is VASTLY better than the hack we have in base now to try and setup ifcfg files. It uses a standard role that has lots of options and does the right thing with NetworkManager. Ideally we would switch everything to this, but lets try it here first to see. It should work with bridges, etc as well. Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
parent
c920b83596
commit
f551e07637
3 changed files with 28 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
dependencies:
|
||||
- { role: linux-system-roles.network, when: network_connections is defined }
|
||||
- { role: basessh }
|
||||
- { role: chrony }
|
||||
- { role: dnf-automatic }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue