diff --git a/salt/map.jinja b/salt/map.jinja index 3ee36c1..37e2f24 100644 --- a/salt/map.jinja +++ b/salt/map.jinja @@ -4,12 +4,14 @@ {## Start with defaults from defaults.yaml ##} {% import_yaml "salt/defaults.yaml" as default_settings %} -{## +{## Setup variable using grains['os_family'] based logic, only add key:values here that differ from whats in defaults.yaml ##} {% set os_family_map = salt['grains.filter_by']({ 'Debian': { + 'pkgrepo': 'deb http://debian.saltstack.com/debian ' + salt['grains.get']('oscodename') + '-saltstack main', + 'key_url': 'salt://' + slspath + '/saltstack.gpg', 'libgit2': 'libgit2-22', 'gitfs': { 'pygit2': { diff --git a/salt/pkgrepo/debian/absent.sls b/salt/pkgrepo/debian/absent.sls index 2ace193..a3eb838 100644 --- a/salt/pkgrepo/debian/absent.sls +++ b/salt/pkgrepo/debian/absent.sls @@ -1,4 +1,8 @@ +{% from "salt/map.jinja" import salt_settings with context %} + drop-saltstack-pkgrepo: + pkgrepo.absent: + - name: {{ salt_settings.pkgrepo }} file.absent: - name: /etc/apt/sources.list.d/saltstack.list diff --git a/salt/pkgrepo/debian/init.sls b/salt/pkgrepo/debian/init.sls index 56ae83d..4483619 100644 --- a/salt/pkgrepo/debian/init.sls +++ b/salt/pkgrepo/debian/init.sls @@ -1,21 +1,11 @@ -saltstack-apt-key: - file.managed: - - name: /etc/apt/trusted.gpg.d/saltstack.gpg - - source: salt://{{ slspath }}/saltstack.gpg - - user: root - - group: root - - mode: 644 +{% from "salt/map.jinja" import salt_settings with context %} saltstack-pkgrepo: - file.managed: - - name: /etc/apt/sources.list.d/saltstack.list - - source: salt://{{ slspath }}/sources.list - - user: root - - group: root - - mode: 644 - - template: jinja - - require: - - file: saltstack-apt-key + pkgrepo.managed: + - humanname: SaltStack Debian Repo + - name: {{ salt_settings.pkgrepo }} + - file: /etc/apt/sources.list.d/saltstack.list + - key_url: {{ salt_settings.key_url }} # Order: 1 because we can't put a require_in on "pkg: salt-{master,minion}" # because we don't know if they are used. - order: 1 diff --git a/salt/pkgrepo/debian/sources.list b/salt/pkgrepo/debian/sources.list deleted file mode 100644 index f99e426..0000000 --- a/salt/pkgrepo/debian/sources.list +++ /dev/null @@ -1,2 +0,0 @@ -# saltstack -deb http://debian.saltstack.com/debian {{ grains['oscodename'] }}-saltstack main