85 lines
2.5 KiB
YAML
85 lines
2.5 KiB
YAML
---
|
|
# Config runs against the chroot, so these write /mnt directly via templates
|
|
# rather than apt_repository/yum_repository, which would touch the live host.
|
|
- name: Write the apt sources.list
|
|
when: os_family == 'Debian'
|
|
vars:
|
|
_debian_release_map:
|
|
"12": bookworm
|
|
"13": trixie
|
|
unstable: sid
|
|
_ubuntu_release_map:
|
|
ubuntu: questing
|
|
ubuntu-lts: resolute
|
|
ansible.builtin.template:
|
|
src: "{{ os | replace('-lts', '') }}.sources.list.j2"
|
|
dest: /mnt/etc/apt/sources.list
|
|
mode: "0644"
|
|
|
|
- name: Ensure apt performance and content-proxy configuration
|
|
when: os_family == 'Debian'
|
|
ansible.builtin.copy:
|
|
dest: /mnt/etc/apt/apt.conf.d/99performance
|
|
content: |
|
|
Acquire::Retries "3";
|
|
Acquire::http::Pipeline-Depth "10";
|
|
APT::Install-Recommends "false";
|
|
{% if system_cfg.content.proxy | length > 0 %}
|
|
Acquire::http::Proxy "{{ system_cfg.content.proxy }}";
|
|
Acquire::https::Proxy "{{ system_cfg.content.proxy }}";
|
|
{% endif %}
|
|
mode: "0644"
|
|
|
|
- name: Drop the install-time DVD repo from the target on non-dvd sources
|
|
when:
|
|
- os_family == 'RedHat'
|
|
- system_cfg.content.source != 'dvd'
|
|
ansible.builtin.file:
|
|
path: /mnt/etc/yum.repos.d/redhat.repo
|
|
state: absent
|
|
|
|
- name: Write the EL mirror repo on the target
|
|
when:
|
|
- os_family == 'RedHat'
|
|
- system_cfg.content.source == 'mirror'
|
|
- system_cfg.content.url | length > 0
|
|
ansible.builtin.template:
|
|
src: el_mirror.repo.j2
|
|
dest: "/mnt/etc/yum.repos.d/{{ os }}.repo"
|
|
mode: "0644"
|
|
|
|
- name: Find the stock vendor repos shipped by the release package
|
|
when:
|
|
- os_family == 'RedHat'
|
|
- system_cfg.content.source == 'mirror'
|
|
- system_cfg.content.url | length > 0
|
|
ansible.builtin.find:
|
|
paths: /mnt/etc/yum.repos.d
|
|
patterns: "*.repo"
|
|
excludes: "{{ os }}.repo"
|
|
register: el_stock_repos
|
|
|
|
- name: Remove the stock vendor repos so only the custom mirror is reachable
|
|
when:
|
|
- os_family == 'RedHat'
|
|
- system_cfg.content.source == 'mirror'
|
|
- system_cfg.content.url | length > 0
|
|
ansible.builtin.file:
|
|
path: "{{ item.path }}"
|
|
state: absent
|
|
loop: "{{ el_stock_repos.files | default([]) }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|
|
|
|
- name: Configure the dnf content proxy on the target
|
|
when:
|
|
- os_family == 'RedHat'
|
|
- system_cfg.content.proxy | length > 0
|
|
ansible.builtin.lineinfile:
|
|
path: /mnt/etc/dnf/dnf.conf
|
|
line: "proxy={{ system_cfg.content.proxy }}"
|
|
regexp: "^proxy="
|
|
create: true
|
|
mode: "0644"
|
|
state: present
|