paulbsd-salt/states/repos/install.sls
2024-02-19 21:24:49 +01:00

47 lines
1.2 KiB
Plaintext

---
{%- from "repos/map.jinja" import repos with context %}
{%- for name,repo in repos.items() %}
{%- if repo.enabled %}
{%- if repo.key_method is defined %}
{%- if repo.key_method == 'file' %}
repo-key-{{ name }}:
file.managed:
- name: /etc/apt/keyrings/{{ name }}
- source: {{ repo.key_url }}
- skip_verify: true
{% endif %}
{% endif %}
repo-{{ name }}:
pkgrepo.managed:
- humanname: {{ repo.humanname }}
{%- if repo.ppa|default(None) %}
- ppa: {{ repo.ppa.src }}
- dist: {{ repo.ppa.dist }}
{%- else %}
- name: deb [signed-by=/etc/apt/keyrings/{{ name }}] {{ repo.src }} {{ repo.suites }} {{ repo.components }}
- gpgcheck: {{ repo.gpgcheck|default(1) }}
- aptkey: false
- file: /etc/apt/sources.list.d/{{ name }}.list
- clean_file: true
{%- if repo.key_method is defined %}
{%- if repo.key_method == 'file' %}
- key_url: {{ repo.key_url }}
{%- elif repo.key_method == 'server' %}
- keyid: {{ repo.keyid }}
- keyserver: {{ repo.keyserver }}
{%- endif %}
{%- endif %}
{%- endif %}
{%- else %}
repo-{{ name }}:
file.absent:
{%- if not repo.ppa %}
- name: /etc/apt/sources.list.d/{{ name }}.list
{%- endif %}
{%- endif %}
{%- endfor %}