-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code to unmount /etc/resolv.conf in Molecule prepare stage
Docker bind mounts a file from the host to /etc/resolv.conf. This is inconvenient for us, since we need to create a symlink at /etc/resolv.conf. At the same time, we don't want to break DNS. The playbook being imported contains a workaround for this situation.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
--- | ||
- name: Import upgrade playbook | ||
ansible.builtin.import_playbook: upgrade.yml | ||
|
||
# Docker bind mounts a file from the host to /etc/resolv.conf. This | ||
# is inconvenient for us, since we need to create a symlink at | ||
# /etc/resolv.conf. At the same time, we don't want to break DNS. | ||
# The playbook being imported contains a workaround for this | ||
# situation. | ||
- name: Unmount /etc/resolv.conf | ||
ansible.builtin.import_playbook: unmount.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Unmount /etc/resolv.conf | ||
hosts: all | ||
become: true | ||
become_method: ansible.builtin.sudo | ||
tasks: | ||
- name: Copy /etc/resolv.conf to /tmp | ||
ansible.builtin.copy: | ||
dest: /tmp/resolv.conf | ||
group: root | ||
mode: u=rw,g=r,o=r | ||
owner: root | ||
remote_src: true | ||
src: /etc/resolv.conf | ||
- name: Unmount /etc/resolv.conf | ||
ansible.posix.mount: | ||
path: /etc/resolv.conf | ||
state: unmounted | ||
- name: Copy /tmp/resolv.conf to /etc | ||
ansible.builtin.copy: | ||
dest: /etc/resolv.conf | ||
group: root | ||
mode: u=rw,g=r,o=r | ||
owner: root | ||
remote_src: true | ||
src: /tmp/resolv.conf |