common/tasks/apt/sources.yaml
Simon Cornet 210fbd68f4
All checks were successful
ci/woodpecker/push/linting Pipeline was successful
chore: cleanup tag mess
Tag only in main.yaml, tasks inherit them.
2026-05-20 09:40:02 +02:00

45 lines
1.7 KiB
YAML

---
# manage apt sources
- name: "manage apt sources"
block:
# configure legacy apt sources
- name: "configure legacy apt sources"
when: >
(ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] | int <= 12) or
(ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] | int <= 23)
block:
# configure apt sources
- name: "apt - config - configure apt sources"
ansible.builtin.template:
src: "templates/apt/sources.d/{{ ansible_facts['distribution'] | lower }}.sources.list.j2"
dest: "/etc/apt/sources.list"
owner: "root"
group: "root"
mode: "0644"
notify: "apt force cache update"
# configure deb822 apt sources
- name: "configure deb822 apt sources"
when: >
(ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] | int >= 13) or
(ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] | int >= 24)
block:
# configure apt sources
- name: "apt - config - configure apt sources"
ansible.builtin.template:
src: "templates/apt/sources.d/{{ ansible_facts['distribution'] | lower }}.sources.j2"
dest: "/etc/apt/sources.list.d/{{ ansible_facts['distribution'] | lower }}.sources"
owner: "root"
group: "root"
mode: "0644"
notify: "apt force cache update"
# delete unused sources.list
- name: "apt - config - remove old sources.list"
ansible.builtin.file:
path: "/etc/apt/sources.list"
state: "absent"