fix: Manage repositories
This commit is contained in:
parent
c825925d7c
commit
028beb4ea0
@ -7,11 +7,24 @@ apt_distribution_sections: main
|
|||||||
|
|
||||||
apt_repositories: []
|
apt_repositories: []
|
||||||
# Exemple:
|
# Exemple:
|
||||||
|
# - name: sid
|
||||||
|
# url: http://deb.debian.org/debian
|
||||||
|
# suites: sid
|
||||||
|
# components: main
|
||||||
|
# key_path: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
# - name: incus
|
# - name: incus
|
||||||
# key: https://pkgs.zabbly.com/key.asc
|
|
||||||
# url: https://pkgs.zabbly.com/incus/stable
|
# url: https://pkgs.zabbly.com/incus/stable
|
||||||
# distribution_release: bookworm
|
# suites: bookworm
|
||||||
# distribution_section: main
|
# components: main
|
||||||
|
# key_url: https://pkgs.zabbly.com/key.asc
|
||||||
|
# key_path: /etc/apt/keyrings/incus.asc
|
||||||
|
|
||||||
|
apt_preferences: []
|
||||||
|
# Exemple:
|
||||||
|
# - filename: sid
|
||||||
|
# package: "*"
|
||||||
|
# pin: release n=sid
|
||||||
|
# priority: 100
|
||||||
|
|
||||||
apt_remove: []
|
apt_remove: []
|
||||||
apt_install: []
|
apt_install: []
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
- name: Importer les tâches d'ajout de dépôts tiers
|
- name: Importer les tâches d'ajout de dépôts tiers
|
||||||
ansible.builtin.import_tasks:
|
ansible.builtin.import_tasks:
|
||||||
file: repositories.yml
|
file: repositories.yml
|
||||||
when: apt_repositories | length > 0
|
|
||||||
|
|
||||||
- name: Exécuter les handlers
|
- name: Exécuter les handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
|
|
||||||
- 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: "{{ item.key_url }}"
|
||||||
dest: "/etc/apt/keyrings/{{ item.name }}.asc"
|
dest: "{{ item.key_path }}"
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
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.name }}"
|
label: "{{ item.name }}"
|
||||||
@ -14,13 +17,28 @@
|
|||||||
|
|
||||||
- name: Ajouter le dépôt
|
- name: Ajouter le dépôt
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: repository.list.j2
|
src: repository.sources.j2
|
||||||
dest: /etc/apt/sources.list.d/{{ item.name }}.list
|
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
|
become: true
|
||||||
loop: "{{ apt_repositories }}"
|
loop: "{{ apt_repositories }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
notify: Mettre à jour le cache
|
notify: Mettre à jour le cache
|
||||||
|
|
||||||
|
- name: Ajouter le fichier de priorité
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: preferences.j2
|
||||||
|
dest: /etc/apt/preferences.d/{{ item.priority }}-{{ item.name }}
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
when: apt_preferences | length > 0
|
||||||
|
become: true
|
||||||
|
loop: "{{ apt_preferences }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.name }}"
|
||||||
|
notify: Mettre à jour le cache
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
APT::Default-Release "{{ apt_distribution_release }}";
|
APT::Default-Release "stable";
|
||||||
APT::Install-Recommends "false";
|
APT::Install-Recommends "false";
|
||||||
APT::Install-Suggests "false";
|
APT::Install-Suggests "false";
|
||||||
APT::Get::Show-Versions "true";
|
APT::Get::Show-Versions "true";
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% if apt_distribution_release == "sid" %}
|
{% if apt_distribution_release == "sid" %}
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: https://deb.debian.org/debian
|
URIs: https://deb.debian.org/debian
|
||||||
Suites: {{ apt_distribution_release }} {{ apt_distribution_release }}-updates {{ apt_distribution_release }}-backports
|
Suites: {{ apt_distribution_release }}
|
||||||
Components: {{ apt_distribution_sections }}
|
Components: {{ apt_distribution_sections }}
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
{% else %}
|
{% else %}
|
||||||
|
5
templates/preferences.j2
Normal file
5
templates/preferences.j2
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
Package: {{ item.package }}
|
||||||
|
Pin: {{ item.pin }}
|
||||||
|
Pin-Priority: {{ item.priority }}
|
@ -1,3 +0,0 @@
|
|||||||
# {{ ansible_managed }}
|
|
||||||
|
|
||||||
deb [signed-by=/etc/apt/keyrings/{{ item.name }}.asc] {{ item.url }} {{ item.distribution_release }} {{ item.distribution_section }}
|
|
7
templates/repository.sources.j2
Normal file
7
templates/repository.sources.j2
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
Types: deb
|
||||||
|
URIs: {{ item.url }}
|
||||||
|
Suites: {{ item.suites }}
|
||||||
|
Components: {{ item.components }}
|
||||||
|
Signed-By: {{ item.key_path }}
|
Loading…
Reference in New Issue
Block a user