From 71b4d8abb8bc59e125498b4882f67631a7840b62 Mon Sep 17 00:00:00 2001 From: N <noel.mcloughlin@gmail.com> Date: Mon, 29 Jul 2019 23:26:08 +0100 Subject: [PATCH] refactor(linux): align to template-formula (plus fixes) --- docs/README.rst | 7 +++---- salt/pkgrepo/debian/absent.sls | 12 +----------- salt/pkgrepo/debian/clean.sls | 13 +++++++++++++ salt/pkgrepo/debian/init.sls | 15 ++++----------- salt/pkgrepo/debian/install.sls | 14 ++++++++++++++ salt/pkgrepo/redhat/absent.sls | 4 +--- salt/pkgrepo/redhat/clean.sls | 6 ++++++ salt/pkgrepo/redhat/init.sls | 15 ++++----------- salt/pkgrepo/redhat/install.sls | 14 ++++++++++++++ salt/pkgrepo/suse/absent.sls | 4 +--- salt/pkgrepo/suse/clean.sls | 6 ++++++ salt/pkgrepo/suse/init.sls | 13 ++++--------- salt/pkgrepo/suse/install.sls | 12 ++++++++++++ 13 files changed, 83 insertions(+), 52 deletions(-) mode change 100644 => 120000 salt/pkgrepo/debian/absent.sls create mode 100644 salt/pkgrepo/debian/clean.sls create mode 100644 salt/pkgrepo/debian/install.sls mode change 100644 => 120000 salt/pkgrepo/redhat/absent.sls create mode 100644 salt/pkgrepo/redhat/clean.sls create mode 100644 salt/pkgrepo/redhat/install.sls mode change 100644 => 120000 salt/pkgrepo/suse/absent.sls create mode 100644 salt/pkgrepo/suse/clean.sls create mode 100644 salt/pkgrepo/suse/install.sls diff --git a/docs/README.rst b/docs/README.rst index 958ef0a..4b01c1c 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -107,13 +107,12 @@ For EL distributions, pygit is installed from packages from `EPEL <https://githu ``salt.pkgrepo`` ^^^^^^^^^^^^^^^^ -Enable the official saltstack package repository in order to always -benefit from the latest version. This state currently only works on Debian, Ubuntu, RHEL 6/7 and aims to implement the `installation recommendations of the official documentation <http://docs.saltstack.com/en/latest/topics/installation/index.html#platform-specific-installation-instructions>`_. +It is recommended to use SaltStack repository for Debian, RedHat, and SuSE, to benefit from the latest stable salt release. Refer to official documentation at <http://docs.saltstack.com/en/latest/topics/installation/index.html#platform-specific-installation-instructions>`_. -``salt.pkgrepo.absent`` +``salt.pkgrepo.clean`` ^^^^^^^^^^^^^^^^^^^^^^^ -Undo the effects of ``salt.pkgrepo``. +Undo the effects of ``salt.pkgrepo`` on Debian, RedHat, and SuSE. ``salt.formulas`` ^^^^^^^^^^^^^^^^^ diff --git a/salt/pkgrepo/debian/absent.sls b/salt/pkgrepo/debian/absent.sls deleted file mode 100644 index a3eb838..0000000 --- a/salt/pkgrepo/debian/absent.sls +++ /dev/null @@ -1,11 +0,0 @@ -{% 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 - -drop-saltstack-apt-key: - file.absent: - - name: /etc/apt/trusted.gpg.d/saltstack.gpg diff --git a/salt/pkgrepo/debian/absent.sls b/salt/pkgrepo/debian/absent.sls new file mode 120000 index 0000000..46623a6 --- /dev/null +++ b/salt/pkgrepo/debian/absent.sls @@ -0,0 +1 @@ +clean.sls \ No newline at end of file diff --git a/salt/pkgrepo/debian/clean.sls b/salt/pkgrepo/debian/clean.sls new file mode 100644 index 0000000..5cd26cc --- /dev/null +++ b/salt/pkgrepo/debian/clean.sls @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +{% from "salt/map.jinja" import salt_settings with context %} + +salt-pkgrepo-clean-saltstack-debian: + pkgrepo.absent: + - name: {{ salt_settings.pkgrepo }} + file.absent: + - name: /etc/apt/sources.list.d/saltstack.list + +salt-pkgrepo-clean-saltstack-debian-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 index 350713f..d3e5518 100644 --- a/salt/pkgrepo/debian/init.sls +++ b/salt/pkgrepo/debian/init.sls @@ -1,12 +1,5 @@ -{% from "salt/map.jinja" import salt_settings with context %} +# -*- coding: utf-8 -*- +# vim: ft=sls -saltstack-pkgrepo: - pkgrepo.managed: - - humanname: SaltStack Debian Repo - - name: {{ salt_settings.pkgrepo }} - - file: /etc/apt/sources.list.d/saltstack.list - - key_url: {{ salt_settings.key_url }} - - clean_file: True - # 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 +include: + - .install diff --git a/salt/pkgrepo/debian/install.sls b/salt/pkgrepo/debian/install.sls new file mode 100644 index 0000000..780bfd0 --- /dev/null +++ b/salt/pkgrepo/debian/install.sls @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +{% from "salt/map.jinja" import salt_settings with context %} + +salt-pkgrepo-install-saltstack-debian: + pkgrepo.managed: + - humanname: SaltStack Debian Repo + - name: {{ salt_settings.pkgrepo }} + - file: /etc/apt/sources.list.d/saltstack.list + - key_url: {{ salt_settings.key_url }} + - clean_file: True + # 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/redhat/absent.sls b/salt/pkgrepo/redhat/absent.sls deleted file mode 100644 index 9945714..0000000 --- a/salt/pkgrepo/redhat/absent.sls +++ /dev/null @@ -1,3 +0,0 @@ -drop-saltstack-pkgrepo: - pkgrepo.absent: - - name: saltstack-pkgrepo diff --git a/salt/pkgrepo/redhat/absent.sls b/salt/pkgrepo/redhat/absent.sls new file mode 120000 index 0000000..46623a6 --- /dev/null +++ b/salt/pkgrepo/redhat/absent.sls @@ -0,0 +1 @@ +clean.sls \ No newline at end of file diff --git a/salt/pkgrepo/redhat/clean.sls b/salt/pkgrepo/redhat/clean.sls new file mode 100644 index 0000000..1310b01 --- /dev/null +++ b/salt/pkgrepo/redhat/clean.sls @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +salt-pkgrepo-clean-saltstack-redhat: + pkgrepo.absent: + - name: saltstack diff --git a/salt/pkgrepo/redhat/init.sls b/salt/pkgrepo/redhat/init.sls index 6a81dd8..d3e5518 100644 --- a/salt/pkgrepo/redhat/init.sls +++ b/salt/pkgrepo/redhat/init.sls @@ -1,12 +1,5 @@ -{% from "salt/map.jinja" import salt_settings with context %} +# -*- coding: utf-8 -*- +# vim: ft=sls -{%- if grains['os']|lower not in ('amazon', 'fedora') %} -saltstack-pkgrepo: - pkgrepo.managed: - - name: saltstack - - humanname: SaltStack repo for RHEL/CentOS $releasever - - baseurl: {{ salt_settings.pkgrepo }} - - enabled: 1 - - gpgcheck: 1 - - gpgkey: {{ salt_settings.key_url }} -{% endif %} +include: + - .install diff --git a/salt/pkgrepo/redhat/install.sls b/salt/pkgrepo/redhat/install.sls new file mode 100644 index 0000000..84e0092 --- /dev/null +++ b/salt/pkgrepo/redhat/install.sls @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +{% from "salt/map.jinja" import salt_settings with context %} + + {%- if grains['os']|lower not in ('amazon', 'fedora') %} +salt-pkgrepo-install-saltstack-redhat: + pkgrepo.managed: + - name: saltstack + - humanname: SaltStack repo for RHEL/CentOS $releasever + - baseurl: {{ salt_settings.pkgrepo }} + - enabled: 1 + - gpgcheck: 1 + - gpgkey: {{ salt_settings.key_url }} + {% endif %} diff --git a/salt/pkgrepo/suse/absent.sls b/salt/pkgrepo/suse/absent.sls deleted file mode 100644 index 9945714..0000000 --- a/salt/pkgrepo/suse/absent.sls +++ /dev/null @@ -1,3 +0,0 @@ -drop-saltstack-pkgrepo: - pkgrepo.absent: - - name: saltstack-pkgrepo diff --git a/salt/pkgrepo/suse/absent.sls b/salt/pkgrepo/suse/absent.sls new file mode 120000 index 0000000..46623a6 --- /dev/null +++ b/salt/pkgrepo/suse/absent.sls @@ -0,0 +1 @@ +clean.sls \ No newline at end of file diff --git a/salt/pkgrepo/suse/clean.sls b/salt/pkgrepo/suse/clean.sls new file mode 100644 index 0000000..09bc765 --- /dev/null +++ b/salt/pkgrepo/suse/clean.sls @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +salt-pkgrepo-clean-saltstack-suse: + pkgrepo.absent: + - name: systemsmanagement_saltstack_products diff --git a/salt/pkgrepo/suse/init.sls b/salt/pkgrepo/suse/init.sls index 2d699e8..d3e5518 100644 --- a/salt/pkgrepo/suse/init.sls +++ b/salt/pkgrepo/suse/init.sls @@ -1,10 +1,5 @@ -{% from "salt/map.jinja" import salt_settings with context %} +# -*- coding: utf-8 -*- +# vim: ft=sls -saltstack-pkgrepo: - pkgrepo.managed: - - name: systemsmanagement_saltstack_products - - humanname: SaltStack repo for Opensuse 42.3 - - baseurl: {{ salt_settings.pkgrepo }} - - enabled: 1 - - gpgcheck: 1 - - gpgkey: {{ salt_settings.key_url }} +include: + - .install diff --git a/salt/pkgrepo/suse/install.sls b/salt/pkgrepo/suse/install.sls new file mode 100644 index 0000000..e6fdaef --- /dev/null +++ b/salt/pkgrepo/suse/install.sls @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +{% from "salt/map.jinja" import salt_settings with context %} + +salt-pkgrepo-install-saltstack-suse: + pkgrepo.managed: + - name: systemsmanagement_saltstack_products + - humanname: SaltStack repo for Opensuse 42.3 + - baseurl: {{ salt_settings.pkgrepo }} + - enabled: 1 + - gpgcheck: 1 + - gpgkey: {{ salt_settings.key_url }}