diff options
author | Egor Tensin <egor@tensin.name> | 2024-03-18 09:57:43 +0100 |
---|---|---|
committer | Egor Tensin <egor@tensin.name> | 2024-03-18 10:04:46 +0100 |
commit | ce47b0d808da622294cee92107564f8a1ae94c1b (patch) | |
tree | c4ae4350ac88a386bb0236013572ee46bb868305 | |
parent | apt_repo: apt_repo_distro -> apt_repo_codename (diff) | |
download | infra-ansible-ce47b0d808da622294cee92107564f8a1ae94c1b.tar.gz infra-ansible-ce47b0d808da622294cee92107564f8a1ae94c1b.zip |
apt_repo: append distribution by default
Diffstat (limited to '')
-rw-r--r-- | roles/apt_repo/defaults/main.yml | 5 | ||||
-rw-r--r-- | roles/apt_repo/tasks/main.yml | 4 | ||||
-rw-r--r-- | roles/apt_repo/templates/repo.list.j2 | 2 | ||||
-rw-r--r-- | roles/ppa/tasks/main.yml | 2 |
4 files changed, 11 insertions, 2 deletions
diff --git a/roles/apt_repo/defaults/main.yml b/roles/apt_repo/defaults/main.yml index d4f4d2b..4168bfd 100644 --- a/roles/apt_repo/defaults/main.yml +++ b/roles/apt_repo/defaults/main.yml @@ -3,6 +3,11 @@ #apt_repo_key_url: #apt_repo_codename: +# Often, APT repository URLs would end with either /debian or /ubuntu. +# For ease of use, this is appended by default. Set to false to disable this +# behaviour. +apt_repo_append_distro: true + # This is a fairly common "component" part value in the repository file. apt_repo_component: main diff --git a/roles/apt_repo/tasks/main.yml b/roles/apt_repo/tasks/main.yml index 83ce845..8cee575 100644 --- a/roles/apt_repo/tasks/main.yml +++ b/roles/apt_repo/tasks/main.yml @@ -25,7 +25,9 @@ - name: Get host distro ansible.builtin.setup: - gather_subset: [distribution_release] + gather_subset: + - distribution + - distribution_release # Not using the apt_repository module, since it _adds_ a new repository # in the .list file. That way, we can end up with an invalid repository diff --git a/roles/apt_repo/templates/repo.list.j2 b/roles/apt_repo/templates/repo.list.j2 index 6bb03b7..8a50ca7 100644 --- a/roles/apt_repo/templates/repo.list.j2 +++ b/roles/apt_repo/templates/repo.list.j2 @@ -1,3 +1,3 @@ {{ ansible_managed | comment }} -deb [signed-by={{ apt_repo_key_path }}] {{ apt_repo_url }} {{ apt_repo_codename | default(ansible_distribution_release) }} {{ apt_repo_component }} +deb [signed-by={{ apt_repo_key_path }}] {{ apt_repo_url }}{{ apt_repo_append_distro | ternary(ansible_distribution | lower, "") }} {{ apt_repo_codename | default(ansible_distribution_release) }} {{ apt_repo_component }} diff --git a/roles/ppa/tasks/main.yml b/roles/ppa/tasks/main.yml index a3c3312..fbe12c0 100644 --- a/roles/ppa/tasks/main.yml +++ b/roles/ppa/tasks/main.yml @@ -24,3 +24,5 @@ apt_repo_key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{ ppa_key }}' apt_repo_url: 'https://ppa.launchpadcontent.net/{{ ppa_owner }}/{{ ppa_name }}/ubuntu' apt_repo_codename: '{{ ppa_distro }}' + # All PPA repositories are Ubuntu repositories, even though they might be used on Debian: + apt_repo_append_distro: false |