feat: Use loop in templates
This commit is contained in:
parent
3ffb13ba5b
commit
fbb43e8c7c
@ -19,6 +19,8 @@ apt_repositories: []
|
|||||||
# key_url: https://pkgs.zabbly.com/key.asc
|
# key_url: https://pkgs.zabbly.com/key.asc
|
||||||
# key_path: /etc/apt/keyrings/incus.asc
|
# key_path: /etc/apt/keyrings/incus.asc
|
||||||
|
|
||||||
|
apt_preferences: []
|
||||||
|
|
||||||
apt_remove: []
|
apt_remove: []
|
||||||
apt_install: []
|
apt_install: []
|
||||||
|
|
||||||
|
@ -18,23 +18,21 @@
|
|||||||
- 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/{{ item.name }}.sources
|
dest: /etc/apt/sources.list.d/99custom.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
|
when: apt_repositories | length > 0
|
||||||
become: true
|
become: true
|
||||||
loop: "{{ apt_repositories }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.name }}"
|
|
||||||
notify: Mettre à jour le cache
|
notify: Mettre à jour le cache
|
||||||
|
|
||||||
- name: Ajouter le fichier de priorité
|
- name: Ajouter le fichier de priorité
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: preferences.j2
|
src: preferences.j2
|
||||||
dest: /etc/apt/preferences.d/40-debian
|
dest: /etc/apt/preferences.d/99custom
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
|
when: apt_preferences | length > 0
|
||||||
become: true
|
become: true
|
||||||
notify: Mettre à jour le cache
|
notify: Mettre à jour le cache
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
Package: *
|
{% for item in apt_preferences %}
|
||||||
Pin: release a=testing
|
Package: {{ item.package }}
|
||||||
Pin-Priority: -10
|
Pin: {{ item.pin }}
|
||||||
|
Pin-Priority: {{ item.priority }}
|
||||||
|
{% if not loop.last %}
|
||||||
|
|
||||||
Package: *
|
{% endif %}
|
||||||
Pin: release a=unstable
|
{% endfor %}
|
||||||
Pin-Priority: -20
|
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
{% for item in apt_repositories %}
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: {{ item.url }}
|
URIs: {{ item.url }}
|
||||||
Suites: {{ item.suites }}
|
Suites: {{ item.suites }}
|
||||||
Components: {{ item.components }}
|
Components: {{ item.components }}
|
||||||
Signed-By: {{ item.key_path }}
|
Signed-By: {{ item.key_path }}
|
||||||
|
{% if not loop.last %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user