From 393d52595fdcbd83bd9f20b40d9cfa47766c3bf2 Mon Sep 17 00:00:00 2001 From: Terry Derks Date: Mon, 5 May 2025 01:07:28 -0400 Subject: [PATCH] updated salt setup --- salt/rhel_install.sls | 4 ++-- setup.sh | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/salt/rhel_install.sls b/salt/rhel_install.sls index ccdadee..a59359a 100644 --- a/salt/rhel_install.sls +++ b/salt/rhel_install.sls @@ -1,6 +1,6 @@ {% from "salt/map.jinja" import salt_daemons with context %} -{% if grains['os'] != 'CentOS' %} +{% if grains['os'] not in ('CentOS', 'AlmaLinux') %} {{ raise("Unsupported distro") }} {% endif %} @@ -10,7 +10,7 @@ salt: pkgrepo.managed: - baseurl: "https://repo.saltproject.io/salt/py3/redhat/{{ grains['osmajorrelease'] }}/x86_64/minor/{{ salt.pillar.get("salt:version") }}" - - humanname: Salt repo for RHEL/CentOS {{ grains['osmajorrelease'] }} PY3 + - humanname: Salt repo for RHEL/CentOS/AlmaLinux {{ grains['osmajorrelease'] }} PY3 - gpgkey: file:///etc/pki/rpm-gpg/SALT-PROJECT-GPG-PUBKEY-2023 - skip_if_unavailable: true - failovermethod: priority diff --git a/setup.sh b/setup.sh index c70a73b..9d0257f 100755 --- a/setup.sh +++ b/setup.sh @@ -2,7 +2,7 @@ set -e -SALT_VERSION='3006.4' +SALT_VERSION='3007.1' CYAN='\033[1;36m' RED='\033[0;31m' @@ -45,6 +45,7 @@ read if ! [ -e /usr/bin/salt-call ]; then if [[ "$DISTRO" == "fedora" ]]; then + mkdir -p /etc/salt/pki/minion echo -e "${CYAN}Fedora detected - installing Python3.10 if not present, then using a venv${NC}" if ! which python3.10 &>/dev/null; then wget -O /usr/local/bin/python3.10 https://github.com/niess/python-appimage/releases/download/python3.10/python3.10.13-cp310-cp310-manylinux_2_28_x86_64.AppImage @@ -62,7 +63,10 @@ if ! [ -e /usr/bin/salt-call ]; then /opt/saltstack/salt/bin/pip3 freeze | grep -q ^salt== || /opt/saltstack/salt/bin/pip3 install "salt==$SALT_VERSION" ln -sfT /opt/saltstack/salt/bin/salt-call /usr/bin/salt-call - elif [[ "$DISTRO" == "centos" ]]; then + elif [[ "$DISTRO" == "centos" ]] || [[ "$DISTRO" == "almalinux" ]]; then + if [[ "$DISTRO" == "almalinux" ]] + OS_VERSION="$(python3 -m distro --json | jq -r .version_parts.major)" + fi rpm --import https://repo.saltproject.io/salt/py3/redhat/$OS_VERSION/x86_64/SALT-PROJECT-GPG-PUBKEY-2023.pub [ -f /etc/yum.repos.d/salt.repo ] || curl -fsSL -o /etc/yum.repos.d/salt.repo https://repo.saltproject.io/salt/py3/redhat/$OS_VERSION/x86_64/minor/$SALT_VERSION.repo