--- {%- from "repo/map.jinja" import repo with context %} {%- for name,repo in repo.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|default(None) %} - name: /etc/apt/sources.list.d/{{ name }}.list {%- endif %} {%- endif %} {%- endfor %}