feat(bootstrap): use configurable mirror and write proper sources.list
This commit is contained in:
@@ -31,10 +31,30 @@
|
||||
- name: Install Debian base system
|
||||
ansible.builtin.command: >-
|
||||
debootstrap --include={{ bootstrap_debian_base_csv }}
|
||||
{{ bootstrap_debian_release }} /mnt https://deb.debian.org/debian/
|
||||
{{ bootstrap_debian_release }} /mnt {{ system_cfg.mirror }}
|
||||
register: bootstrap_debian_base_result
|
||||
changed_when: bootstrap_debian_base_result.rc == 0
|
||||
|
||||
- name: Write bootstrap sources.list
|
||||
ansible.builtin.template:
|
||||
src: debian.sources.list.j2
|
||||
dest: /mnt/etc/apt/sources.list
|
||||
mode: "0644"
|
||||
|
||||
- name: Configure apt performance tuning
|
||||
ansible.builtin.copy:
|
||||
dest: /mnt/etc/apt/apt.conf.d/99performance
|
||||
content: |
|
||||
Acquire::Retries "3";
|
||||
Acquire::http::Pipeline-Depth "10";
|
||||
APT::Install-Recommends "false";
|
||||
mode: "0644"
|
||||
|
||||
- name: Update package lists
|
||||
ansible.builtin.command: "{{ chroot_command }} apt update"
|
||||
register: bootstrap_debian_update_result
|
||||
changed_when: bootstrap_debian_update_result.rc == 0
|
||||
|
||||
- name: Install extra packages
|
||||
when: bootstrap_debian_extra_args | trim | length > 0
|
||||
ansible.builtin.command: "{{ chroot_command }} apt install -y {{ bootstrap_debian_extra_args }}"
|
||||
|
||||
@@ -30,15 +30,24 @@
|
||||
--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||
--include={{ bootstrap_ubuntu_base_csv }}
|
||||
{{ bootstrap_ubuntu_release }} /mnt
|
||||
https://archive.ubuntu.com/ubuntu/
|
||||
{{ system_cfg.mirror }}
|
||||
register: bootstrap_ubuntu_base_result
|
||||
changed_when: bootstrap_ubuntu_base_result.rc == 0
|
||||
|
||||
- name: Enable universe repository
|
||||
ansible.builtin.replace:
|
||||
path: /mnt/etc/apt/sources.list
|
||||
regexp: '^(deb\s+\S+\s+\S+\s+main)$'
|
||||
replace: '\1 universe'
|
||||
- name: Write bootstrap sources.list
|
||||
ansible.builtin.template:
|
||||
src: ubuntu.sources.list.j2
|
||||
dest: /mnt/etc/apt/sources.list
|
||||
mode: "0644"
|
||||
|
||||
- name: Configure apt performance tuning
|
||||
ansible.builtin.copy:
|
||||
dest: /mnt/etc/apt/apt.conf.d/99performance
|
||||
content: |
|
||||
Acquire::Retries "3";
|
||||
Acquire::http::Pipeline-Depth "10";
|
||||
APT::Install-Recommends "false";
|
||||
mode: "0644"
|
||||
|
||||
- name: Update package lists
|
||||
ansible.builtin.command: "{{ chroot_command }} apt update"
|
||||
|
||||
15
roles/bootstrap/templates/debian.sources.list.j2
Normal file
15
roles/bootstrap/templates/debian.sources.list.j2
Normal file
@@ -0,0 +1,15 @@
|
||||
# Managed by Ansible.
|
||||
{% set release = bootstrap_debian_release %}
|
||||
{% set mirror = system_cfg.mirror %}
|
||||
{% set components = 'main contrib non-free' ~ (' non-free-firmware' if (os_version | string) not in ['10', '11'] else '') %}
|
||||
|
||||
deb {{ mirror }} {{ release }} {{ components }}
|
||||
deb-src {{ mirror }} {{ release }} {{ components }}
|
||||
{% if release != 'sid' %}
|
||||
|
||||
deb https://security.debian.org/debian-security {{ release }}-security {{ components }}
|
||||
deb-src https://security.debian.org/debian-security {{ release }}-security {{ components }}
|
||||
|
||||
deb {{ mirror }} {{ release }}-updates {{ components }}
|
||||
deb-src {{ mirror }} {{ release }}-updates {{ components }}
|
||||
{% endif %}
|
||||
16
roles/bootstrap/templates/ubuntu.sources.list.j2
Normal file
16
roles/bootstrap/templates/ubuntu.sources.list.j2
Normal file
@@ -0,0 +1,16 @@
|
||||
# Managed by Ansible.
|
||||
{% set release = bootstrap_ubuntu_release %}
|
||||
{% set mirror = system_cfg.mirror %}
|
||||
{% set components = 'main restricted universe multiverse' %}
|
||||
|
||||
deb {{ mirror }} {{ release }} {{ components }}
|
||||
deb-src {{ mirror }} {{ release }} {{ components }}
|
||||
|
||||
deb {{ mirror }} {{ release }}-updates {{ components }}
|
||||
deb-src {{ mirror }} {{ release }}-updates {{ components }}
|
||||
|
||||
deb {{ mirror }} {{ release }}-security {{ components }}
|
||||
deb-src {{ mirror }} {{ release }}-security {{ components }}
|
||||
|
||||
deb {{ mirror }} {{ release }}-backports {{ components }}
|
||||
deb-src {{ mirror }} {{ release }}-backports {{ components }}
|
||||
Reference in New Issue
Block a user