role_apt/tasks/preferences.yml

25 lines
705 B
YAML
Raw Normal View History

2025-01-02 13:18:09 +01:00
---
# tasks file for apt
- name: Construire la liste des règles
ansible.builtin.set_fact:
nftables_rules: "{{ nftables_rules + specific }}"
when: specific | length > 0
loop: "{{ lookup('ansible.builtin.varnames', '^nftables_rules_.+', wantlist=True) }}"
vars:
specific: "{{ lookup('ansible.builtin.vars', item, default='') }}"
- name: Ajouter le fichier de priorité
ansible.builtin.template:
src: preferences.j2
dest: /etc/apt/preferences.d/{{ item.name }}
owner: root
group: root
mode: u=rw,g=r,o=r
when: apt_preferences | length > 0
loop: "{{ apt_preferences }}"
loop_control:
label: "{{ item.name }}"
become: true
notify: Mettre à jour le cache