role_apt/tasks/repositories.yml

36 lines
1005 B
YAML
Raw Normal View History

2023-11-28 10:57:22 +01:00
---
# tasks file for apt
2025-01-02 13:18:09 +01:00
- name: Construire la liste des dépôts
ansible.builtin.set_fact:
apt_repositories: "{{ apt_repositories + specific }}"
when: specific | length > 0
loop: "{{ lookup('ansible.builtin.varnames', '^apt_repositories_.+', wantlist=True) }}"
vars:
specific: "{{ lookup('ansible.builtin.vars', item, default='') }}"
2023-11-28 10:57:22 +01:00
- name: Télécharger la clef du dépôt
ansible.builtin.get_url:
2024-06-03 18:05:23 +02:00
url: "{{ item.key_url }}"
dest: "{{ item.key_path }}"
2023-11-28 10:57:22 +01:00
mode: u=rw,g=r,o=r
2025-01-02 13:18:09 +01:00
when: item.get('key_url', '') | length > 0
2023-11-28 10:57:22 +01:00
become: true
loop: "{{ apt_repositories }}"
loop_control:
2025-01-02 13:18:09 +01:00
label: "{{ item.name }}"
2023-11-28 10:57:22 +01:00
notify: Mettre à jour le cache
- name: Ajouter le dépôt
ansible.builtin.template:
2024-06-03 18:05:23 +02:00
src: repository.sources.j2
2025-01-02 13:18:09 +01:00
dest: /etc/apt/sources.list.d/{{ item.name }}.sources
2024-06-03 18:05:23 +02:00
owner: root
group: root
mode: u=rw,g=r,o=r
become: true
2025-01-02 13:18:09 +01:00
loop: "{{ apt_repositories }}"
loop_control:
label: "{{ item.name }}"
2024-06-03 18:05:23 +02:00
notify: Mettre à jour le cache