Skip to content

Commit 3e77ef9

Browse files
committed
reset NM control of resolv.conf after build
1 parent f925f93 commit 3e77ef9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ansible/cleanup.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,24 @@
55
- name: Remove dnf caches
66
command: dnf clean all
77

8+
# If image build happens on a Neutron subnet with property dns_namservers defined, then cloud-init
9+
# disables NetworkManager's control of /etc/resolv.conf and appends nameservers itself.
10+
# We don't want network configuration during instance boot to depend on the configuration
11+
# of the network the builder was on, so we reset these aspects.
812
- name: Delete /etc/resolv.conf
9-
# required as if cloud-init (rather than network manager) controls this on next boot it won't be entirely overrwritten
1013
file:
1114
path: /etc/resolv.conf
1215
state: absent
1316

17+
- name: Reenable NetworkManager control of resolv.conf
18+
file:
19+
path: /etc/NetworkManager/conf.d/99-cloud-init.conf
20+
state: absent
21+
1422
- name: Delete any injected ssh config for rocky
1523
file:
1624
path: /home/rocky/.ssh/
1725
state: absent
1826

1927
- name: Run cloud-init cleanup
2028
command: cloud-init clean --logs --seed
21-

0 commit comments

Comments
 (0)