From 5659281c801b6497b73e519bdd9d60a59534bfab Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Fri, 7 Aug 2020 10:34:04 +0200 Subject: [PATCH] cleaned up repositories --- salt/pillars/hosts/exsilio.sls | 17 +++-------------- salt/pillars/repos/google_chrome.sls | 9 +++++++++ salt/pillars/repos/msteams.sls | 8 ++++++++ salt/pillars/repositories.sls | 16 ---------------- salt/pillars/top.sls | 10 ++++------ salt/states/repositories.sls | 16 +++++++++------- 6 files changed, 33 insertions(+), 43 deletions(-) create mode 100644 salt/pillars/repos/google_chrome.sls create mode 100644 salt/pillars/repos/msteams.sls delete mode 100644 salt/pillars/repositories.sls diff --git a/salt/pillars/hosts/exsilio.sls b/salt/pillars/hosts/exsilio.sls index f186fec..4a2720e 100644 --- a/salt/pillars/hosts/exsilio.sls +++ b/salt/pillars/hosts/exsilio.sls @@ -1,21 +1,10 @@ +includes: + - repos.msteams + packages: teams: { status: installed } rocketchat: { status: installed } -repositories: - msteams: - humanname: Microsoft Teams - baseurl: https://packages.microsoft.com/yumrepos/ms-teams - enabled: True - gpgautoimport: True - refresh: True - google-chrome: - humanname: Google Chrome - baseurl: https://dl.google.com/linux/chrome/rpm/stable/x86_64 - enabled: True - gpgautoimport: True - refresh: True - firefox: addons: Okta Browser Plugin: https://addons.mozilla.org/en-US/firefox/addon/okta-browser-plugin/ diff --git a/salt/pillars/repos/google_chrome.sls b/salt/pillars/repos/google_chrome.sls new file mode 100644 index 0000000..672cb82 --- /dev/null +++ b/salt/pillars/repos/google_chrome.sls @@ -0,0 +1,9 @@ +repositories: + google-chrome: + humanname: google-chrome + baseurl: https://dl.google.com/linux/chrome/rpm/stable/x86_64/ + enabled: True + gpgautoimport: True + gpgkey: /root/google_linux_signing_key.pub + refresh: True + signingkey: google_linux_signing_key.pub diff --git a/salt/pillars/repos/msteams.sls b/salt/pillars/repos/msteams.sls new file mode 100644 index 0000000..96e0909 --- /dev/null +++ b/salt/pillars/repos/msteams.sls @@ -0,0 +1,8 @@ +repositories: + msteams: + humanname: Microsoft Teams + baseurl: https://packages.microsoft.com/yumrepos/ms-teams + enabled: True + gpgautoimport: True + refresh: True + signingkey: microsoft.asc diff --git a/salt/pillars/repositories.sls b/salt/pillars/repositories.sls deleted file mode 100644 index 41a0c5a..0000000 --- a/salt/pillars/repositories.sls +++ /dev/null @@ -1,16 +0,0 @@ -repositories: - google-chrome: - humanname: google-chrome - baseurl: https://dl.google.com/linux/chrome/rpm/stable/x86_64/ - enabled: True - gpgautoimport: True - gpgkey: /root/google_linux_signing_key.pub - refresh: True -{% if grains['os'] == "SUSE" %} - packman: - humanname: packman - baseurl: https://ftp.gwdg.de/pub/linux/misc/packman/suse/{{ grains['oscodename'].replace(" ", "_") }}/ - enabled: True - gpgautoimport: True - refresh: True -{% endif %} diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls index 8841329..c398f99 100644 --- a/salt/pillars/top.sls +++ b/salt/pillars/top.sls @@ -1,12 +1,10 @@ base: '*': - packages - - repositories - vim - firefox - hosts - -#{% if salt['file.file_exists']('hosts/{0}.sls'.format(grains.nodename)) %} -# '{{ grains.nodename }}': -# - hosts.{{ grains.nodename }} -#{% endif %} + - repos.google_chrome + {% if grains['os'] == "SUSE" -%} + - repos.packman + {% endif %} diff --git a/salt/states/repositories.sls b/salt/states/repositories.sls index 2fe9e2d..4b3a580 100644 --- a/salt/states/repositories.sls +++ b/salt/states/repositories.sls @@ -1,17 +1,19 @@ -add the google-chrome signing key: +{% for repo, args in salt['pillar.get']('repositories', {}).items() %} +{% if 'signingkey' in args %} +Add {{ repo }} signing key: file.managed: - - name: /root/google_linux_signing_key.pub - - source: salt://files/google_linux_signing_key.pub + - name: /root/{{ args['signingkey'] }} + - source: salt://files/{{ args['signingkey'] }} - user: root - group: root -import google signing key: +Import {{ repo }} signing key: cmd.run: - - name: rpm --import /root/google_linux_signing_key.pub + - name: rpm --import /root/{{ args['signingkey'] }} - onchanges: - - file: add the google-chrome signing key + - file: Add {{ repo }} signing key +{% endif %} -{% for repo, args in salt['pillar.get']('repositories', {}).items() %} Add {{ repo }} repository: pkgrepo.managed: - name: {{ repo }}