From 620d374730cc94b993e4d4460757c60f434bb46a Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Fri, 14 Sep 2018 16:28:37 -0500 Subject: [PATCH] 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 --- .../roles/deploy-kubelet/tasks/setup-dns.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubelet/tasks/setup-dns.yaml b/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubelet/tasks/setup-dns.yaml index cc31168b7..947efd339 100644 --- a/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubelet/tasks/setup-dns.yaml +++ b/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubelet/tasks/setup-dns.yaml @@ -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: