paulbsd-salt/states/repos/repos.sls

48 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-10-01 20:12:26 +02:00
---
{%- from "repos/map.jinja" import repos with context %}
{%- for repo in repos %}
{%- if repo.enabled %}
{%- if repo.key_method is defined %}
{%- if repo.key_method == 'file' %}
repo-key-{{ repo.name }}:
file.managed:
- name: /etc/apt/keyrings/{{ repo.name }}
- source: {{ repo.key_url }}
- skip_verify: true
{% endif %}
{% endif %}
repo-{{ repo.name }}:
pkgrepo.managed:
- humanname: {{ repo.humanname }}
{%- if repo.ppa %}
- ppa: {{ repo.ppasrc }}
- dist: {{ repo.dist }}
{%- else %}
- name: deb [signed-by=/etc/apt/keyrings/{{ repo.name }}] {{ repo.src }} {{ repo.suites }} {{ repo.components }}
- gpgcheck: {{ repo.gpgcheck|default(1) }}
- aptkey: false
- file: {{ repo.file }}
- 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-{{ repo.name }}:
file.absent:
{%- if not repo.ppa %}
- name: {{ repo.file }}
{%- endif %}
{%- endif %}
{%- endfor %}