fix(bootstrap): unify resolv.conf to live environment DNS symlink
This commit is contained in:
@@ -16,12 +16,6 @@
|
||||
register: bootstrap_almalinux_base_result
|
||||
changed_when: bootstrap_almalinux_base_result.rc == 0
|
||||
|
||||
- name: Ensure chroot has resolv.conf
|
||||
ansible.builtin.file:
|
||||
src: /run/NetworkManager/resolv.conf
|
||||
dest: /mnt/etc/resolv.conf
|
||||
state: link
|
||||
|
||||
- name: Install extra packages
|
||||
ansible.builtin.command: >-
|
||||
{{ chroot_command }} dnf --releasever={{ os_version }} --setopt=install_weak_deps=False
|
||||
|
||||
@@ -6,13 +6,6 @@
|
||||
lookup('vars', bootstrap_var_key) | reject('equalto', '') | join(' ')
|
||||
}}
|
||||
block:
|
||||
- name: Ensure chroot has resolv.conf
|
||||
ansible.builtin.file:
|
||||
src: /run/NetworkManager/resolv.conf
|
||||
dest: /mnt/etc/resolv.conf
|
||||
state: link
|
||||
force: true
|
||||
|
||||
- name: Install Alpine Linux packages
|
||||
ansible.builtin.command: >
|
||||
apk --root /mnt --no-cache add alpine-base
|
||||
|
||||
@@ -55,18 +55,6 @@
|
||||
register: bootstrap_debian_base_result
|
||||
changed_when: bootstrap_debian_base_result.rc == 0
|
||||
|
||||
- name: Generate resolv.conf for chroot
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
{% for ns in system_cfg.network.dns.servers | default(['1.1.1.1', '8.8.8.8']) %}
|
||||
nameserver {{ ns }}
|
||||
{% endfor %}
|
||||
{% if system_cfg.network.dns.search | default([]) | length > 0 %}
|
||||
search {{ system_cfg.network.dns.search | join(' ') }}
|
||||
{% endif %}
|
||||
dest: /mnt/etc/resolv.conf
|
||||
mode: "0644"
|
||||
|
||||
- name: Install extra packages
|
||||
when: bootstrap_debian_extra_packages | length > 0
|
||||
ansible.builtin.command: "{{ chroot_command }} apt install -y {{ bootstrap_debian_extra_args }}"
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
register: bootstrap_fedora_base_result
|
||||
changed_when: bootstrap_fedora_base_result.rc == 0
|
||||
|
||||
- name: Ensure chroot has resolv.conf
|
||||
ansible.builtin.file:
|
||||
src: /run/NetworkManager/resolv.conf
|
||||
dest: /mnt/etc/resolv.conf
|
||||
state: link
|
||||
|
||||
- name: Install extra packages
|
||||
ansible.builtin.command: >-
|
||||
{{ chroot_command }} dnf --releasever={{ os_version }} --setopt=install_weak_deps=False
|
||||
|
||||
@@ -39,3 +39,10 @@
|
||||
void: void.yml
|
||||
bootstrap_var_key: "{{ 'bootstrap_' + (os | replace('-lts', '') | replace('-', '_')) }}"
|
||||
ansible.builtin.include_tasks: "{{ bootstrap_os_task_map[os] }}"
|
||||
|
||||
- name: Ensure chroot uses live environment DNS
|
||||
ansible.builtin.file:
|
||||
src: /run/NetworkManager/resolv.conf
|
||||
dest: /mnt/etc/resolv.conf
|
||||
state: link
|
||||
force: true
|
||||
|
||||
@@ -6,13 +6,6 @@
|
||||
lookup('vars', bootstrap_var_key) | reject('equalto', '') | join(' ')
|
||||
}}
|
||||
block:
|
||||
- name: Ensure chroot has resolv.conf
|
||||
ansible.builtin.file:
|
||||
src: /run/NetworkManager/resolv.conf
|
||||
dest: /mnt/etc/resolv.conf
|
||||
state: link
|
||||
force: true
|
||||
|
||||
- name: Install openSUSE base packages
|
||||
ansible.builtin.command: >
|
||||
zypper --root /mnt --non-interactive install -t pattern patterns-base-base
|
||||
|
||||
@@ -13,18 +13,6 @@
|
||||
- bootstrap_result.rc != 0
|
||||
- "'grub2-common' not in (bootstrap_result.stderr | default(''))"
|
||||
|
||||
- name: Write resolv.conf into chroot
|
||||
ansible.builtin.copy:
|
||||
dest: /mnt/etc/resolv.conf
|
||||
mode: "0644"
|
||||
content: |
|
||||
{% for dns in system_cfg.network.dns.servers %}
|
||||
nameserver {{ dns }}
|
||||
{% endfor %}
|
||||
{% if system_cfg.network.dns.search | default([]) | length > 0 %}
|
||||
search {{ system_cfg.network.dns.search | join(' ') }}
|
||||
{% endif %}
|
||||
|
||||
- name: Ensure chroot RHEL DVD directory exists
|
||||
ansible.builtin.file:
|
||||
path: /mnt/usr/local/install/redhat/dvd
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
register: bootstrap_rocky_base_result
|
||||
changed_when: bootstrap_rocky_base_result.rc == 0
|
||||
|
||||
- name: Ensure chroot has resolv.conf
|
||||
ansible.builtin.file:
|
||||
src: /run/NetworkManager/resolv.conf
|
||||
dest: /mnt/etc/resolv.conf
|
||||
state: link
|
||||
|
||||
- name: Install extra packages
|
||||
ansible.builtin.command: >-
|
||||
{{ chroot_command }} dnf --releasever={{ os_version }} --setopt=install_weak_deps=False
|
||||
|
||||
@@ -47,18 +47,6 @@
|
||||
register: bootstrap_ubuntu_base_result
|
||||
changed_when: bootstrap_ubuntu_base_result.rc == 0
|
||||
|
||||
- name: Generate resolv.conf for chroot
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
{% for ns in system_cfg.network.dns.servers | default(['1.1.1.1', '8.8.8.8']) %}
|
||||
nameserver {{ ns }}
|
||||
{% endfor %}
|
||||
{% if system_cfg.network.dns.search | default([]) | length > 0 %}
|
||||
search {{ system_cfg.network.dns.search | join(' ') }}
|
||||
{% endif %}
|
||||
dest: /mnt/etc/resolv.conf
|
||||
mode: "0644"
|
||||
|
||||
- name: Enable universe repository
|
||||
ansible.builtin.command: "{{ chroot_command }} sed -i '1s|$| universe|' /etc/apt/sources.list"
|
||||
register: bootstrap_ubuntu_repo_result
|
||||
|
||||
@@ -6,13 +6,6 @@
|
||||
lookup('vars', bootstrap_var_key) | reject('equalto', '') | join(' ')
|
||||
}}
|
||||
block:
|
||||
- name: Ensure chroot has resolv.conf
|
||||
ansible.builtin.file:
|
||||
src: /run/NetworkManager/resolv.conf
|
||||
dest: /mnt/etc/resolv.conf
|
||||
state: link
|
||||
force: true
|
||||
|
||||
- name: Install Void Linux base packages
|
||||
ansible.builtin.command: >
|
||||
xbps-install -Sy -r /mnt -R https://repo-default.voidlinux.org/current void-repo-nonfree base-system
|
||||
|
||||
Reference in New Issue
Block a user