fix: Deploy repositories
This commit is contained in:
parent
e4fccbface
commit
c0f2b31437
@ -9,6 +9,11 @@
|
|||||||
ansible.builtin.import_tasks:
|
ansible.builtin.import_tasks:
|
||||||
file: repositories.yml
|
file: repositories.yml
|
||||||
|
|
||||||
|
- name: Importer les tâches d'ajout des préférences
|
||||||
|
ansible.builtin.import_tasks:
|
||||||
|
file: preferences.yml
|
||||||
|
when: apt_preferences | length > 0
|
||||||
|
|
||||||
- name: Exécuter les handlers
|
- name: Exécuter les handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
|
||||||
|
24
tasks/preferences.yml
Normal file
24
tasks/preferences.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
# 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
|
@ -1,38 +1,35 @@
|
|||||||
---
|
---
|
||||||
# tasks file for apt
|
# tasks file for apt
|
||||||
|
|
||||||
|
- 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='') }}"
|
||||||
|
|
||||||
- name: Télécharger la clef du dépôt
|
- name: Télécharger la clef du dépôt
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ item.key_url }}"
|
url: "{{ item.key_url }}"
|
||||||
dest: "{{ item.key_path }}"
|
dest: "{{ item.key_path }}"
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
|
when: item.get('key_url', '') | length > 0
|
||||||
become: true
|
become: true
|
||||||
when:
|
|
||||||
- apt_repositories | length > 0
|
|
||||||
- item.get('key_url', '') | length > 0
|
|
||||||
loop: "{{ apt_repositories }}"
|
loop: "{{ apt_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.url }}"
|
label: "{{ item.name }}"
|
||||||
notify: Mettre à jour le cache
|
notify: Mettre à jour le cache
|
||||||
|
|
||||||
- name: Ajouter le dépôt
|
- name: Ajouter le dépôt
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: repository.sources.j2
|
src: repository.sources.j2
|
||||||
dest: /etc/apt/sources.list.d/99custom.sources
|
dest: /etc/apt/sources.list.d/{{ item.name }}.sources
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: u=rw,g=r,o=r
|
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
|
become: true
|
||||||
|
loop: "{{ apt_repositories }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.name }}"
|
||||||
notify: Mettre à jour le cache
|
notify: Mettre à jour le cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user