role_apt/tasks/repositories.yml

39 lines
948 B
YAML

---
# tasks file for apt
- name: Télécharger la clef du dépôt
ansible.builtin.get_url:
url: "{{ item.key_url }}"
dest: "{{ item.key_path }}"
mode: u=rw,g=r,o=r
become: true
when:
- apt_repositories | length > 0
- item.get('key_url', '') | length > 0
loop: "{{ apt_repositories }}"
loop_control:
label: "{{ item.url }}"
notify: Mettre à jour le cache
- name: Ajouter le dépôt
ansible.builtin.template:
src: repository.sources.j2
dest: /etc/apt/sources.list.d/99custom.sources
owner: root
group: root
mode: u=rw,g=r,o=r
when: apt_repositories | length > 0
become: true
notify: Mettre à jour le cache
- name: Ajouter le fichier de priorité
ansible.builtin.template:
src: preferences.j2
dest: /etc/apt/preferences.d/99custom
owner: root
group: root
mode: u=rw,g=r,o=r
when: apt_preferences | length > 0
become: true
notify: Mettre à jour le cache