paulbsd-salt/states/repos/install.sls
2023-03-10 00:08:54 +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 %}
- ppa: {{ repo.ppasrc }}
- dist: {{ repo.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 %}