From fc133bd165054ac758e695d985c53237c3262e16 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 27 Apr 2022 09:11:08 -0700 Subject: [PATCH] Enable deb-src on Debian with a flag in configure-mirrors This enables deb-src repos on Debian hosts with a flag. The flag currently defaults to True to maintain backward compatible behavior with the hardcoded deb-src repos that configure-mirrors previously set. We intend on flipping this default to False after announcing this change. The reasons for this are that source package repos are rarely needed by CI systems, but these repos can consume large amounts of disk in mirrors. To make it easier to people deploying mirrors we want to avoid enabling source repos by default. Change-Id: I7e9cd0ec1e3184c3c0561bbb7d3069feaf5f1ba5 --- roles/configure-mirrors/README.rst | 10 +++++++++- roles/configure-mirrors/defaults/main.yaml | 1 + .../apt/etc/apt/sources.list.d/backports.list.j2 | 2 ++ .../apt/etc/apt/sources.list.d/default.list.j2 | 2 ++ .../apt/etc/apt/sources.list.d/security.list.j2 | 2 ++ .../apt/etc/apt/sources.list.d/updates.list.j2 | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/roles/configure-mirrors/README.rst b/roles/configure-mirrors/README.rst index 7d2ce0f9d..3d11207c5 100644 --- a/roles/configure-mirrors/README.rst +++ b/roles/configure-mirrors/README.rst @@ -31,7 +31,15 @@ An ansible role to configure services to use mirrors. when accessing unsigned mirrors with newer releases like Ubuntu Bionic. --- zuul:rolevar:: configure_mirrors_extra_repos +.. zuul:rolevar:: enable_deb_src_repos + :default: True + + Set this to True in order to enable deb-src entries in sources.list + configs for apt. Note this option currently only works on Debian + (not Ubuntu) installations and will be set to default to False in + the near future. + +.. zuul:rolevar:: configure_mirrors_extra_repos :default: True Set to False to opt-out of installing extra repositories such diff --git a/roles/configure-mirrors/defaults/main.yaml b/roles/configure-mirrors/defaults/main.yaml index 188c21161..f8230f15f 100644 --- a/roles/configure-mirrors/defaults/main.yaml +++ b/roles/configure-mirrors/defaults/main.yaml @@ -10,4 +10,5 @@ http_or_https: >- {%- endif -%} pypi_mirror: "{{ http_or_https }}://{{ pypi_fqdn }}/pypi/simple" wheel_mirror: "{{ http_or_https }}://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}" +enable_deb_src_repos: True configure_mirrors_extra_repos: True diff --git a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/backports.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/backports.list.j2 index 82a9787f1..485651c25 100644 --- a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/backports.list.j2 +++ b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/backports.list.j2 @@ -1,3 +1,5 @@ # {{ ansible_managed }} deb {{ package_mirror }} {{ ansible_distribution_release }}-backports main +{% if enable_deb_src_repos | bool -%} deb-src {{ package_mirror }} {{ ansible_distribution_release }}-backports main +{% endif -%} diff --git a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/default.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/default.list.j2 index ca3240d38..07ebb910a 100644 --- a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/default.list.j2 +++ b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/default.list.j2 @@ -1,3 +1,5 @@ # {{ ansible_managed }} deb {{ package_mirror }} {{ ansible_distribution_release }} main +{% if enable_deb_src_repos | bool -%} deb-src {{ package_mirror }} {{ ansible_distribution_release }} main +{% endif -%} diff --git a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/security.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/security.list.j2 index 71bdabdbd..d22515378 100644 --- a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/security.list.j2 +++ b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/security.list.j2 @@ -1,3 +1,5 @@ # {{ ansible_managed }} deb {{ security_mirror }} {{ ansible_distribution_release }}{% if ansible_distribution_release not in ['jessie', 'stretch', 'buster'] %}-security{% endif %} main +{% if enable_deb_src_repos | bool -%} deb-src {{ security_mirror }} {{ ansible_distribution_release }}{% if ansible_distribution_release not in ['jessie', 'stretch', 'buster'] %}-security{% endif %} main +{% endif -%} diff --git a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/updates.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/updates.list.j2 index 155b23024..159677462 100644 --- a/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/updates.list.j2 +++ b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/updates.list.j2 @@ -1,3 +1,5 @@ # {{ ansible_managed }} deb {{ package_mirror }} {{ ansible_distribution_release }}-updates main +{% if enable_deb_src_repos | bool -%} deb-src {{ package_mirror }} {{ ansible_distribution_release }}-updates main +{% endif -%}