From 4dc5ebdba08a4d5a452b7b7852e9a1310fb39368 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:25 -0400 Subject: [PATCH] Move to more dynamic apt configs Allow specifying repository URLs in the group_vars, and add release-specific template files to support future version changes. --- group_vars/default/base.yml | 3 +++ roles/base/tasks/main.yml | 2 +- .../etc/apt/sources.list.x86_64.buster.j2 | 14 ++++++++++++++ .../base/templates/etc/apt/sources.list.x86_64.j2 | 14 -------------- 4 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 roles/base/templates/etc/apt/sources.list.x86_64.buster.j2 delete mode 100644 roles/base/templates/etc/apt/sources.list.x86_64.j2 diff --git a/group_vars/default/base.yml b/group_vars/default/base.yml index fe56420..46344e4 100644 --- a/group_vars/default/base.yml +++ b/group_vars/default/base.yml @@ -9,6 +9,9 @@ timezone_location: Canada/Eastern # Cluster domain for node FQDNs local_domain: upstream.local +# Debian package repository URL +debian_repository: http://ftp.debian.org/debian + # IPMI user and password # > For the password, use pwgen to generate. # > Set these in the IPMI configuration as a user with permissions to reboot the host. diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 405c6e6..dcbf3ab 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -78,7 +78,7 @@ with_items: - { src: "etc/apt/apt.conf.d/10norecommends.j2", dest: "/etc/apt/apt.conf.d/10norecommends" } - { src: "etc/apt/preferences.d/pins.j2", dest: "/etc/apt/preferences.d/pins" } - - { src: "etc/apt/sources.list.{{ ansible_machine }}.j2", dest: "/etc/apt/sources.list" } + - { src: "etc/apt/sources.list.{{ ansible_machine }}.{{ ansible_distribution_release }}.j2", dest: "/etc/apt/sources.list" } tags: base-apt - name: add key for bonilan repo diff --git a/roles/base/templates/etc/apt/sources.list.x86_64.buster.j2 b/roles/base/templates/etc/apt/sources.list.x86_64.buster.j2 new file mode 100644 index 0000000..d208010 --- /dev/null +++ b/roles/base/templates/etc/apt/sources.list.x86_64.buster.j2 @@ -0,0 +1,14 @@ +# apt configuration: main sources list (buster) +# {{ ansible_managed }} + +deb {{ debian_main_repository }} buster main contrib non-free +deb-src {{ debian_main_repository }} buster main contrib + +deb {{ debian_security_repository }} buster/updates main contrib +deb-src {{ debian_security_repository }} buster/updates main contrib + +deb {{ debian_main_repository }} buster-updates main contrib +deb-src {{ debian_main_repository }} buster-updates main contrib + +deb {{ debian_pvc_repository }} buster pvc +deb-src {{ debian_pvc_repository }} buster pvc diff --git a/roles/base/templates/etc/apt/sources.list.x86_64.j2 b/roles/base/templates/etc/apt/sources.list.x86_64.j2 deleted file mode 100644 index 968e43d..0000000 --- a/roles/base/templates/etc/apt/sources.list.x86_64.j2 +++ /dev/null @@ -1,14 +0,0 @@ -# apt configuration: main sources list -# {{ ansible_managed }} - -deb http://ftp.debian.org/debian {{ ansible_distribution_release }} main contrib non-free -deb-src http://ftp.debian.org/debian {{ ansible_distribution_release }} main contrib - -deb http://security.debian.org/ {{ ansible_distribution_release }}/updates main contrib -deb-src http://security.debian.org/ {{ ansible_distribution_release }}/updates main contrib - -deb http://ftp.debian.org/debian/ {{ ansible_distribution_release }}-updates main contrib -deb-src http://ftp.debian.org/debian/ {{ ansible_distribution_release }}-updates main contrib - -deb https://repo.bonifacelabs.net/debian/ {{ ansible_distribution_release }} pvc -deb-src https://repo.bonifacelabs.net/debian/ {{ ansible_distribution_release }} pvc