diff --git a/README.rst b/README.rst index 62724dc..b7b3292 100644 --- a/README.rst +++ b/README.rst @@ -47,6 +47,20 @@ Configure pillar data under salt:ssh_roster to feed the template. Install a minion and configure it in `standalone mode `_. +``salt.pkgrepo`` +---------------- + +Enable the official saltstack package repository in order to always +benefit from the latest version. This state currently only works on Debian +and Ubuntu, and aims to implement the `installation recommendations of the +official documentation +`_. + +``salt.pkgrepo.absent`` +----------------------- + +Undo the effects of ``salt.pkgrepo``. + ``Configuration`` ================= Every option available in the templates can be set in pillar. Settings under 'salt' will be overridden by more specific settings under ``salt['master']``, ``salt['minion']`` or ``salt['cloud']`` diff --git a/salt/pkgrepo/absent.sls b/salt/pkgrepo/absent.sls new file mode 100644 index 0000000..d79b15f --- /dev/null +++ b/salt/pkgrepo/absent.sls @@ -0,0 +1,2 @@ +include: + - .{{ grains['os']|lower }}.absent diff --git a/salt/pkgrepo/debian/absent.sls b/salt/pkgrepo/debian/absent.sls new file mode 100644 index 0000000..2ace193 --- /dev/null +++ b/salt/pkgrepo/debian/absent.sls @@ -0,0 +1,7 @@ +drop-saltstack-pkgrepo: + file.absent: + - name: /etc/apt/sources.list.d/saltstack.list + +drop-saltstack-apt-key: + file.absent: + - name: /etc/apt/trusted.gpg.d/saltstack.gpg diff --git a/salt/pkgrepo/debian/init.sls b/salt/pkgrepo/debian/init.sls new file mode 100644 index 0000000..ffe7165 --- /dev/null +++ b/salt/pkgrepo/debian/init.sls @@ -0,0 +1,21 @@ +saltstack-apt-key: + file.managed: + - name: /etc/apt/trusted.gpg.d/saltstack.gpg + - source: salt://salt/pkgrepo/debian/saltstack.gpg + - user: root + - group: root + - mode: 644 + +saltstack-pkgrepo: + file.managed: + - name: /etc/apt/sources.list.d/saltstack.list + - source: salt://salt/pkgrepo/debian/sources.list + - user: root + - group: root + - mode: 644 + - template: jinja + - require: + - file: saltstack-apt-key + # 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/saltstack.gpg b/salt/pkgrepo/debian/saltstack.gpg new file mode 100644 index 0000000..78da01e Binary files /dev/null and b/salt/pkgrepo/debian/saltstack.gpg differ diff --git a/salt/pkgrepo/debian/sources.list b/salt/pkgrepo/debian/sources.list new file mode 100644 index 0000000..f99e426 --- /dev/null +++ b/salt/pkgrepo/debian/sources.list @@ -0,0 +1,2 @@ +# saltstack +deb http://debian.saltstack.com/debian {{ grains['oscodename'] }}-saltstack main diff --git a/salt/pkgrepo/init.sls b/salt/pkgrepo/init.sls new file mode 100644 index 0000000..0d41bc4 --- /dev/null +++ b/salt/pkgrepo/init.sls @@ -0,0 +1,2 @@ +include: + - .{{ grains['os']|lower }} diff --git a/salt/pkgrepo/ubuntu/absent.sls b/salt/pkgrepo/ubuntu/absent.sls new file mode 100644 index 0000000..27b5fd6 --- /dev/null +++ b/salt/pkgrepo/ubuntu/absent.sls @@ -0,0 +1,3 @@ +drop-saltstack-pkgrepo: + pkgrepo.absent: + - ppa: saltstack/salt diff --git a/salt/pkgrepo/ubuntu/init.sls b/salt/pkgrepo/ubuntu/init.sls new file mode 100644 index 0000000..bd3986a --- /dev/null +++ b/salt/pkgrepo/ubuntu/init.sls @@ -0,0 +1,3 @@ +saltstack-pkgrepo: + pkgrepo.managed: + - ppa: saltstack/salt