From a9ae6e7d0731f19cf5d01a429a5b5b5b2e7e5d04 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 15 Sep 2020 20:39:22 +0200 Subject: improve handling of apt-repo providers --- inventory/group_vars/all/main.yml | 41 +++++++++++++++++++--- inventory/group_vars/vmhost-ch-atlas/main.yml | 2 ++ inventory/host_vars/ch-keyserver.yml | 2 -- inventory/host_vars/ch-testvm.yml | 2 -- inventory/host_vars/ele-mur.yml | 2 -- inventory/host_vars/r3-vex2.yml | 2 -- inventory/host_vars/sk-testvm.yml | 2 ++ roles/apt-repo/backports/tasks/main.yml | 2 +- roles/apt-repo/base/templates/Debian.list.j2 | 6 ++-- roles/apt-repo/base/templates/Ubuntu.list.j2 | 6 ++-- roles/installer/debian/fetch/defaults/main.yml | 6 ++-- .../preseed/templates/preseed_debian-buster.cfg.j2 | 7 ++-- .../preseed/templates/preseed_debian-jessie.cfg.j2 | 5 +-- .../templates/preseed_debian-stretch.cfg.j2 | 7 ++-- .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 7 ++-- .../preseed/templates/preseed_ubuntu-focal.cfg.j2 | 7 ++-- .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 7 ++-- .../templates/preseed_xubuntu-focal-desktop.cfg.j2 | 7 ++-- 18 files changed, 77 insertions(+), 43 deletions(-) diff --git a/inventory/group_vars/all/main.yml b/inventory/group_vars/all/main.yml index accb807e..540c4a3e 100644 --- a/inventory/group_vars/all/main.yml +++ b/inventory/group_vars/all/main.yml @@ -22,8 +22,41 @@ sshd_allowusers_group: "{{ admin_users_group }}" apt_repo_provider: default apt_repo_providers: default: - debian: deb.debian.org - ubuntu: archive.ubuntu.com + debian: + host: deb.debian.org + path: /debian + debian_security: + host: deb.debian.org + path: /debian-security + debian_archive: + host: archive.debian.org + path: /debian + ubuntu: + host: archive.ubuntu.com + path: /ubuntu + hetzner: + debian: + host: mirror.hetzner.de + path: /debian/packages + debian_security: + host: mirror.hetzner.de + path: /debian/security + debian_archive: + host: archive.debian.org + path: /debian + ubuntu: + host: mirror.hetzner.de + path: /ubuntu/packages ffgraz: - debian: debian.ffgraz.net - ubuntu: debian.ffgraz.net + debian: + host: debian.ffgraz.net + path: /debian + debian_security: + host: debian.ffgraz.net + path: /debian-security + debian_archive: + host: debian.ffgraz.net + path: /archive + ubuntu: + host: debian.ffgraz.net + path: /ubuntu diff --git a/inventory/group_vars/vmhost-ch-atlas/main.yml b/inventory/group_vars/vmhost-ch-atlas/main.yml index 4b7af32f..ce0421b5 100644 --- a/inventory/group_vars/vmhost-ch-atlas/main.yml +++ b/inventory/group_vars/vmhost-ch-atlas/main.yml @@ -23,3 +23,5 @@ vm_host: funkfeuer: interfaces: - eth0.502 + +apt_repo_provider: ffgraz diff --git a/inventory/host_vars/ch-keyserver.yml b/inventory/host_vars/ch-keyserver.yml index 131da209..b5519d46 100644 --- a/inventory/host_vars/ch-keyserver.yml +++ b/inventory/host_vars/ch-keyserver.yml @@ -1,6 +1,4 @@ --- -apt_repo_provider: ffgraz - install: vm: memory: 2G diff --git a/inventory/host_vars/ch-testvm.yml b/inventory/host_vars/ch-testvm.yml index 7f74a891..e86eb632 100644 --- a/inventory/host_vars/ch-testvm.yml +++ b/inventory/host_vars/ch-testvm.yml @@ -1,6 +1,4 @@ --- -apt_repo_provider: ffgraz - install: vm: memory: 1G diff --git a/inventory/host_vars/ele-mur.yml b/inventory/host_vars/ele-mur.yml index 3ee20fa4..810489e8 100644 --- a/inventory/host_vars/ele-mur.yml +++ b/inventory/host_vars/ele-mur.yml @@ -3,8 +3,6 @@ ssh_users_root: - equinox - datacop -apt_repo_provider: ffgraz - install: vm: memory: 1G diff --git a/inventory/host_vars/r3-vex2.yml b/inventory/host_vars/r3-vex2.yml index bf602568..9cc33fd4 100644 --- a/inventory/host_vars/r3-vex2.yml +++ b/inventory/host_vars/r3-vex2.yml @@ -1,6 +1,4 @@ --- -apt_repo_provider: ffgraz - install: vm: memory: 2G diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index c9a27b92..8975c258 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -1,4 +1,6 @@ --- +apt_repo_provider: hetzner + install: vm: memory: 1G diff --git a/roles/apt-repo/backports/tasks/main.yml b/roles/apt-repo/backports/tasks/main.yml index 20854816..7f182ca7 100644 --- a/roles/apt-repo/backports/tasks/main.yml +++ b/roles/apt-repo/backports/tasks/main.yml @@ -2,7 +2,7 @@ - name: add repository entry copy: content: | - deb http://{{ apt_repo_providers[apt_repo_provider][(ansible_distribution | lower)] }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}-backports {{ apt_repo_components | default(apt_repo_backports_components[(ansible_distribution | lower)]) | join(' ') }} + deb http://{{ apt_repo_providers[apt_repo_provider][(ansible_distribution | lower)].host }}{{ apt_repo_providers[apt_repo_provider][(ansible_distribution | lower)].path }} {{ ansible_distribution_release }}-backports {{ apt_repo_components | default(apt_repo_backports_components[(ansible_distribution | lower)]) | join(' ') }} dest: /etc/apt/sources.list.d/backports.list notify: update apt cache diff --git a/roles/apt-repo/base/templates/Debian.list.j2 b/roles/apt-repo/base/templates/Debian.list.j2 index 44b4abdd..a3cfae8a 100644 --- a/roles/apt-repo/base/templates/Debian.list.j2 +++ b/roles/apt-repo/base/templates/Debian.list.j2 @@ -1,3 +1,3 @@ -deb http://{{ apt_repo_providers[apt_repo_provider].debian }}/debian {{ ansible_distribution_release }} {{ apt_repo_components | default(apt_repo_base_components.debian) | join(' ') }} -deb http://{{ apt_repo_providers[apt_repo_provider].debian }}/debian {{ ansible_distribution_release }}-updates {{ apt_repo_components | default(apt_repo_base_components.debian) | join(' ') }} -deb http://{{ apt_repo_providers[apt_repo_provider].debian }}/debian-security {{ ansible_distribution_release }}/updates {{ apt_repo_components | default(apt_repo_base_components.debian) | join(' ') }} +deb http://{{ apt_repo_providers[apt_repo_provider].debian.host }}{{ apt_repo_providers[apt_repo_provider].debian.path }} {{ ansible_distribution_release }} {{ apt_repo_components | default(apt_repo_base_components.debian) | join(' ') }} +deb http://{{ apt_repo_providers[apt_repo_provider].debian.host }}{{ apt_repo_providers[apt_repo_provider].debian.path }} {{ ansible_distribution_release }}-updates {{ apt_repo_components | default(apt_repo_base_components.debian) | join(' ') }} +deb http://{{ apt_repo_providers[apt_repo_provider].debian_security.host }}{{ apt_repo_providers[apt_repo_provider].debian_security.path }} {{ ansible_distribution_release }}/updates {{ apt_repo_components | default(apt_repo_base_components.debian) | join(' ') }} diff --git a/roles/apt-repo/base/templates/Ubuntu.list.j2 b/roles/apt-repo/base/templates/Ubuntu.list.j2 index 2a336994..0fb4d04a 100644 --- a/roles/apt-repo/base/templates/Ubuntu.list.j2 +++ b/roles/apt-repo/base/templates/Ubuntu.list.j2 @@ -1,3 +1,3 @@ -deb http://{{ apt_repo_providers[apt_repo_provider].ubuntu }}/ubuntu {{ ansible_distribution_release }} {{ apt_repo_components | default(apt_repo_base_components.ubuntu) | join(' ') }} -deb http://{{ apt_repo_providers[apt_repo_provider].ubuntu }}/ubuntu {{ ansible_distribution_release }}-updates {{ apt_repo_components | default(apt_repo_base_components.ubuntu) | join(' ') }} -deb http://{{ apt_repo_providers[apt_repo_provider].ubuntu }}/ubuntu {{ ansible_distribution_release }}-security {{ apt_repo_components | default(apt_repo_base_components.ubuntu) | join(' ') }} +deb http://{{ apt_repo_providers[apt_repo_provider].ubuntu.host }}{{ apt_repo_providers[apt_repo_provider].ubuntu.path }} {{ ansible_distribution_release }} {{ apt_repo_components | default(apt_repo_base_components.ubuntu) | join(' ') }} +deb http://{{ apt_repo_providers[apt_repo_provider].ubuntu.host }}{{ apt_repo_providers[apt_repo_provider].ubuntu.path }} {{ ansible_distribution_release }}-updates {{ apt_repo_components | default(apt_repo_base_components.ubuntu) | join(' ') }} +deb http://{{ apt_repo_providers[apt_repo_provider].ubuntu.host }}{{ apt_repo_providers[apt_repo_provider].ubuntu.path }} {{ ansible_distribution_release }}-security {{ apt_repo_components | default(apt_repo_base_components.ubuntu) | join(' ') }} diff --git a/roles/installer/debian/fetch/defaults/main.yml b/roles/installer/debian/fetch/defaults/main.yml index eebc59bf..1b9f8206 100644 --- a/roles/installer/debian/fetch/defaults/main.yml +++ b/roles/installer/debian/fetch/defaults/main.yml @@ -6,7 +6,5 @@ debian_installer_arch: amd64 debian_installer_force_download: no debian_installer_url: -# debian: "https://debian.ffgraz.net/debian" -# ubuntu: "https://debian.ffgraz.net/ubuntu" - debian: "http://deb.debian.org/debian" - ubuntu: "http://archive.ubuntu.com/ubuntu" + debian: "http://{{ apt_repo_providers[apt_repo_provider].debian.host }}{{ apt_repo_providers[apt_repo_provider].debian.path }}" + ubuntu: "http://{{ apt_repo_providers[apt_repo_provider].ubuntu.host }}{{ apt_repo_providers[apt_repo_provider].ubuntu.path }}" diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 index a6e7b3fc..ad421b78 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -31,8 +31,8 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian }} -d-i mirror/http/directory string /debian +d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.host }} +d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.path }} d-i mirror/http/proxy string @@ -50,7 +50,8 @@ d-i clock-setup/ntp boolean false d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian }} +d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.host }} +d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.path }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt diff --git a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 index bb275e98..cc1f5037 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -31,8 +31,8 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string archive.debian.org -d-i mirror/http/directory string /debian +d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_archive.host }} +d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_archive.path }} d-i mirror/http/proxy string @@ -51,6 +51,7 @@ d-i clock-setup/ntp boolean false d-i base-installer/install-recommends boolean false d-i apt-setup/security_host string +#d-i apt-setup/security_host string tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt diff --git a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 index fc41e876..773ebbb1 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -31,8 +31,8 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian }} -d-i mirror/http/directory string /debian +d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.host }} +d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.path }} d-i mirror/http/proxy string @@ -50,7 +50,8 @@ d-i clock-setup/ntp boolean false d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian }} +d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.host }} +d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.path }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index 7a21c082..019e9fcb 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -38,8 +38,8 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} -d-i mirror/http/directory string /ubuntu +d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} d-i mirror/http/proxy string @@ -58,7 +58,8 @@ d-i clock-setup/ntp boolean false d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} +d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} {% if hostvars[install_hostname].install_cooked.arch | default('amd64') == 'amd64' %} d-i apt-setup/multiarch string amd64 {% endif %} diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 index 9280e3ca..59bb5282 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -38,8 +38,8 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} -d-i mirror/http/directory string /ubuntu +d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} d-i mirror/http/proxy string @@ -58,7 +58,8 @@ d-i clock-setup/ntp boolean false d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} +d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} {% if hostvars[install_hostname].install_cooked.arch | default('amd64') == 'amd64' %} d-i apt-setup/multiarch string amd64 {% endif %} diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index 758cf961..4b144cef 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -35,8 +35,8 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} -d-i mirror/http/directory string /ubuntu +d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} d-i mirror/http/proxy string @@ -55,7 +55,8 @@ d-i clock-setup/ntp boolean false d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} +d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} {% if hostvars[install_hostname].install_cooked.arch | default('amd64') == 'amd64' %} d-i apt-setup/multiarch string amd64 {% endif %} diff --git a/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 index 5eafb358..66974576 100644 --- a/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 @@ -41,8 +41,8 @@ d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} -d-i mirror/http/directory string /ubuntu +d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} d-i mirror/http/proxy string @@ -61,7 +61,8 @@ d-i clock-setup/ntp boolean false d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu }} +d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }} +d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }} {% if hostvars[install_hostname].install_cooked.arch | default('amd64') == 'amd64' %} d-i apt-setup/multiarch string amd64 {% endif %} -- cgit v1.2.3