Gate: only restart network manager if required

We only need to restart network manager if disabling dns management.

Change-Id: Idfdf68678a68c2808527de4226ff91e9ea5f8d67
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2018-09-14 16:28:37 -05:00 committed by Pete Birley
parent 79d11e4044
commit 620d374730

View File

@ -15,8 +15,15 @@
register: network_manager_in_use
ignore_errors: True
- name: DNS | Check if NetworkManager is managing DNS
set_fact:
network_manager_manage_dns: "{{ lookup('ini', 'dns section=main file=/etc/NetworkManager/NetworkManager.conf') }}"
ignore_errors: True
- name: DNS | Disable network NetworkManager management of resolv.conf
when: network_manager_in_use is succeeded
when:
- network_manager_in_use is succeeded
- network_manager_manage_dns != "none"
ini_file:
path: /etc/NetworkManager/NetworkManager.conf
section: main
@ -30,7 +37,9 @@
dest: /etc/resolv.conf
- name: DNS | Restarting NetworkManager
when: network_manager_in_use is succeeded
when:
- network_manager_in_use is succeeded
- network_manager_manage_dns != "none"
block:
- name: DNS | Restarting NetworkManager Service
systemd: