From cb726afb104111046984c83934bdde110572cb59 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Thu, 19 Sep 2019 00:19:26 +0100 Subject: [PATCH] fix(pkgrepo): provide settings for `amazon` --- salt/osfamilymap.yaml | 2 ++ salt/osmap.yaml | 6 ++++++ salt/pkgrepo/redhat/install.sls | 14 +++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/salt/osfamilymap.yaml b/salt/osfamilymap.yaml index 24576d9..4c64e98 100644 --- a/salt/osfamilymap.yaml +++ b/salt/osfamilymap.yaml @@ -41,6 +41,8 @@ Debian: install_from_source: false RedHat: + pkgrepo_name: saltstack + pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever pkgrepo: 'https://repo.saltstack.com/{{ py_ver_repr }}/redhat/$releasever/$basearch/{{ salt_release }}' key_url: 'https://repo.saltstack.com/{{ py_ver_repr }}/redhat/$releasever/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' pygit2: python-pygit2 diff --git a/salt/osmap.yaml b/salt/osmap.yaml index 9686416..55d16b3 100644 --- a/salt/osmap.yaml +++ b/salt/osmap.yaml @@ -19,6 +19,12 @@ Fedora: pygit2: python2-pygit2 +Amazon: + pkgrepo_name: saltstack-amzn-repo + pkgrepo_humanname: SaltStack repo for Amazon Linux 2 + pkgrepo: 'https://repo.saltstack.com/yum/amazon/2/$basearch/{{ salt_release }}' + key_url: 'https://repo.saltstack.com/yum/amazon/2/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' + Ubuntu: pkgrepo: 'deb http://repo.saltstack.com/{{ py_ver_dir }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }} {{ oscodename }} main' key_url: 'https://repo.saltstack.com/{{ py_ver_dir }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' diff --git a/salt/pkgrepo/redhat/install.sls b/salt/pkgrepo/redhat/install.sls index 84e0092..32b8d1a 100644 --- a/salt/pkgrepo/redhat/install.sls +++ b/salt/pkgrepo/redhat/install.sls @@ -1,14 +1,18 @@ # -*- coding: utf-8 -*- # vim: ft=sls -{% from "salt/map.jinja" import salt_settings with context %} +{%- from "salt/map.jinja" import salt_settings with context %} - {%- if grains['os']|lower not in ('amazon', 'fedora') %} +{%- if grains['os']|lower not in ['fedora'] %} salt-pkgrepo-install-saltstack-redhat: pkgrepo.managed: - - name: saltstack - - humanname: SaltStack repo for RHEL/CentOS $releasever + - name: {{ salt_settings.pkgrepo_name }} + - humanname: {{ salt_settings.pkgrepo_humanname }} - baseurl: {{ salt_settings.pkgrepo }} - enabled: 1 - gpgcheck: 1 - gpgkey: {{ salt_settings.key_url }} - {% endif %} + {%- if grains['os']|lower in ['amazon'] %} + - failovermethod: priority + - priority: 10 + {%- endif %} +{%- endif %}