{% for repo, args in salt['pillar.get']('repositories', {}).items() %} {% if 'signingkey' in args %} Add {{ repo }} signing key: file.managed: - name: /root/{{ args['signingkey'] }} - source: salt://files/{{ args['signingkey'] }} - user: root - group: root Import {{ repo }} signing key: cmd.run: - name: rpm --import /root/{{ args['signingkey'] }} - onchanges: - file: Add {{ repo }} signing key {% endif %} Add {{ repo }} repository: pkgrepo.managed: - name: {{ repo }} - humanname: {{ args['humanname'] }} - baseurl: {{ args['baseurl'] }} - enabled: {{ args['enabled'] }} - gpgautoimport: {{ args['gpgautoimport'] }} - refresh: {{ args['refresh'] }} {% if 'gpgkey' in args -%} - gpgkey: {{ args['gpgkey'] }} {% endif %} {% endfor %}