From b7885f0dd6c85823559d8b3000bb7cb7546813aa Mon Sep 17 00:00:00 2001 From: ramishra Date: Mon, 15 Feb 2021 11:36:10 +0530 Subject: [PATCH] Stop NetworkManager from updating resolv.conf cloud-init creates /etc/NetworkManager/conf.d/99-cloud-init.conf, for NetworkManager to not update resolv.conf. However, subsequent update of NetworkManager seems to remove that file as there is no config(noreplace) directive for it. So after an update/upgrade of overcloud nodes, reboot would cleanup the dns entries. cloud-init do configuration only one time during first instance boot. So this would ensure resolv.conf is not touched during subsequent reboots. Change-Id: I989e3f1d14fd33e97933032111cf48166dc5f50c (cherry picked from commit 6881079d12a9fb2cf752a5f56116c1b4d3a7b75d) --- roles/tripleo-bootstrap/tasks/main.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/roles/tripleo-bootstrap/tasks/main.yml b/roles/tripleo-bootstrap/tasks/main.yml index 993007dfd..41ce2596a 100644 --- a/roles/tripleo-bootstrap/tasks/main.yml +++ b/roles/tripleo-bootstrap/tasks/main.yml @@ -11,6 +11,30 @@ rpm -q {{ item }} with_items: "{{ packages_bootstrap }}" +- name: Populate service facts + service_facts: + +- name: Stop NetworkManager from updating resolv.conf + become: true + when: + - ansible_os_family | lower == 'redhat' + - ansible_distribution_major_version | int >= 7 + - "'NetworkManager.service' in ansible_facts.services" + - ansible_facts.services['NetworkManager.service']['status'] == 'enabled' + block: + - name: Set 'dns=none' in /etc/NetworkManager/NetworkManager.conf + ini_file: + path: /etc/NetworkManager/NetworkManager.conf + state: present + no_extra_spaces: true + section: main + option: dns + value: none + backup: true + - name: Reload NetworkManager + service: + name: NetworkManager + state: reloaded - name: Create /var/lib/heat-config/tripleo-config-download directory for deployment data file: