paulbsd-salt/states/repos/init.sls

40 lines
942 B
Plaintext

---
repo-require:
cmd.run:
- name: apt install -y python3-apt
{%- for repo in pillar.get('repos') %}
{%- if repo['enabled'] %}
repo-{{ repo['name'] }}:
pkgrepo.managed:
- humanname: {{ repo['humanname'] }}
{%- if repo['ppa'] %}
- ppa: {{ repo['ppasrc'] }}
- dist: {{ repo['dist'] }}
{%- elif not repo['ppa'] %}
- name: {{ repo['src'] }}
- gpgcheck: {{ repo['gpgcheck']|default(1) }}
- 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 %}
- refresh: true
{%- else %}
repo-{{ repo['name'] }}:
file.absent:
{%- if not repo['ppa'] %}
- name: {{ repo['file'] }}
{%- endif %}
{%- endif %}
{%- endfor %}