Add a test for nmcli and also a blacklist var we can set on hosts that shouldn't have ifcfg managed by ansible.
This commit is contained in:
parent
18f920701a
commit
d5a366b5f6
1 changed files with 8 additions and 3 deletions
|
@ -20,11 +20,16 @@
|
||||||
- base
|
- base
|
||||||
- ifcfg
|
- ifcfg
|
||||||
|
|
||||||
|
- name: check for NetworkManager/nmcli
|
||||||
|
command: /usr/bin/test -f /usr/bin/nmcli
|
||||||
|
register: nmclitest
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
- name: disable resolv.conf control from NM
|
- name: disable resolv.conf control from NM
|
||||||
ini_file: dest=/etc/NetworkManager/NetworkManager.conf section=main option=dns value=none
|
ini_file: dest=/etc/NetworkManager/NetworkManager.conf section=main option=dns value=none
|
||||||
notify:
|
notify:
|
||||||
- restart NetworkManager
|
- restart NetworkManager
|
||||||
when: ansible_distribution_major_version|int >=7
|
when: ansible_distribution_major_version|int >=7 and nmclitest|success and ansible_ifcfg_blacklist not defined
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
- resolvconf
|
- resolvconf
|
||||||
|
@ -37,7 +42,7 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: 'if_uuid.stdout == ""'
|
failed_when: 'if_uuid.stdout == ""'
|
||||||
always_run: yes
|
always_run: yes
|
||||||
when: ansible_distribution_major_version|int >=7
|
when: ansible_distribution_major_version|int >=7 and nmclitest|success and ansible_ifcfg_blacklist not defined
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
- ifcfg
|
- ifcfg
|
||||||
|
@ -51,7 +56,7 @@
|
||||||
# - restart NetworkManager
|
# - restart NetworkManager
|
||||||
- reload NetworkManager-connections
|
- reload NetworkManager-connections
|
||||||
- apply interface-changes
|
- apply interface-changes
|
||||||
when: (virthost is not defined) and (not item.startswith('tun')) and (not item.startswith('virbr')) and (hostvars[inventory_hostname]['ansible_' + item.replace('-','_')]['type'] == 'ether') and (ansible_distribution_major_version|int >=7) and hostvars[inventory_hostname]['ansible_' + item.replace('-','_')]['active']
|
when: (virthost is not defined) and (not item.startswith('tun')) and (not item.startswith('virbr')) and (hostvars[inventory_hostname]['ansible_' + item.replace('-','_')]['type'] == 'ether') and (ansible_distribution_major_version|int >=7) and hostvars[inventory_hostname]['ansible_' + item.replace('-','_')]['active'] and nmclitest|success and ansible_ifcfg_blacklist not defined
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
- ifcfg
|
- ifcfg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue