Skip to content

Commit 21608fb

Browse files
author
Derek
committed
fix: add LTS codename fallback for HashiCorp, Docker, and git-core repos
Ubuntu interim releases (25.04+) aren't published in third-party repos. Fall back to noble (24.04 LTS) for HashiCorp, Docker, and git-core PPA when running on versions > 24.04, matching the existing Azure CLI pattern.
1 parent 4b456b8 commit 21608fb

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

ansible/roles/developer/tasks/cloud.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@
1414
dest: /usr/share/keyrings/hashicorp-archive-keyring.asc
1515
mode: '0644'
1616

17+
# Map unsupported Ubuntu releases to nearest supported LTS
18+
# HashiCorp only publishes repos for LTS releases (jammy, noble)
19+
- name: Determine HashiCorp repo codename
20+
ansible.builtin.set_fact:
21+
hashicorp_codename: >-
22+
{{ (ansible_facts['distribution_version'] is version('24.04', '>'))
23+
| ternary('noble', ansible_facts['distribution_release']) }}
24+
1725
- name: Add HashiCorp repository
1826
ansible.builtin.apt_repository:
19-
repo: "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.asc] https://apt.releases.hashicorp.com {{ ansible_facts['distribution_release'] }} main"
27+
repo: "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.asc] https://apt.releases.hashicorp.com {{ hashicorp_codename }} main"
2028
filename: hashicorp
2129
state: present
2230

ansible/roles/developer/tasks/docker.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,17 @@
3131
dest: /etc/apt/keyrings/docker.asc
3232
mode: '0644'
3333

34+
# Map unsupported Ubuntu releases to nearest supported LTS
35+
# Docker only publishes repos for LTS releases (jammy, noble)
36+
- name: Determine Docker repo codename
37+
ansible.builtin.set_fact:
38+
docker_codename: >-
39+
{{ (ansible_facts['distribution_version'] is version('24.04', '>'))
40+
| ternary('noble', ansible_facts['distribution_release']) }}
41+
3442
- name: Add Docker repository
3543
ansible.builtin.apt_repository:
36-
repo: "deb [arch={{ docker_arch }} signed-by=/etc/apt/keyrings/docker.asc] {{ docker_repo_url }} {{ ansible_facts['distribution_release'] }} stable"
44+
repo: "deb [arch={{ docker_arch }} signed-by=/etc/apt/keyrings/docker.asc] {{ docker_repo_url }} {{ docker_codename }} stable"
3745
filename: docker
3846
state: present
3947

ansible/roles/developer/tasks/git.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,17 @@
6464
executable: /bin/bash
6565
creates: /etc/apt/keyrings/git-core-ppa.gpg
6666

67+
# Map unsupported Ubuntu releases to nearest supported LTS
68+
# Launchpad PPAs only publish for LTS releases (jammy, noble)
69+
- name: Determine git-core PPA codename
70+
ansible.builtin.set_fact:
71+
git_ppa_codename: >-
72+
{{ (ansible_facts['distribution_version'] is version('24.04', '>'))
73+
| ternary('noble', ansible_facts['distribution_release']) }}
74+
6775
- name: Add git-core PPA repository
6876
ansible.builtin.apt_repository:
69-
repo: "deb [signed-by=/etc/apt/keyrings/git-core-ppa.gpg] https://ppa.launchpadcontent.net/git-core/ppa/ubuntu {{ ansible_facts['distribution_release'] }} main"
77+
repo: "deb [signed-by=/etc/apt/keyrings/git-core-ppa.gpg] https://ppa.launchpadcontent.net/git-core/ppa/ubuntu {{ git_ppa_codename }} main"
7078
filename: git-core-ppa
7179
state: present
7280

0 commit comments

Comments
 (0)