Compare commits
2 Commits
896e005a98
...
1726c412ce
| Author | SHA1 | Date | |
|---|---|---|---|
| 1726c412ce | |||
| 393d52595f |
@@ -1,35 +1,39 @@
|
|||||||
# A deploy key must be added for this to work!
|
# A deploy key must be added for this to work!
|
||||||
/usr/local/lib/nagios:
|
|
||||||
|
{% set git_dir = '/usr/local/lib/icinga' %}
|
||||||
|
{% set venv_dir = '%s/venv' | format(git_dir) %}
|
||||||
|
|
||||||
|
{{ git_dir }}:
|
||||||
git.cloned:
|
git.cloned:
|
||||||
- name: {{ salt.pillar.get("icinga2:monitoring_plugins_git_url") | yaml_encode }}
|
- name: {{ salt.pillar.get("icinga2:monitoring_plugins_git_url") | yaml_encode }}
|
||||||
- target: /usr/local/lib/nagios
|
- target: {{ git_dir }}
|
||||||
- branch: master
|
- branch: master
|
||||||
- user: root
|
- user: root
|
||||||
|
|
||||||
/usr/local/lib/nagios/venv:
|
{{ venv_dir }}:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
{% if 'inmotionhosting' in grains.fqdn %}
|
{% if 'inmotionhosting' in grains.fqdn %}
|
||||||
- name: imh-python3 -m venv /usr/local/lib/nagios/venv
|
- name: imh-python3 -m venv {{ venv_dir }}
|
||||||
{% else %}
|
{% else %}
|
||||||
- name: python3 -m venv /usr/local/lib/nagios/venv
|
- name: python3 -m venv {{ venv_dir }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- creates: /usr/local/lib/nagios/venv
|
- creates: {{ venv_dir }}
|
||||||
- require:
|
- require:
|
||||||
- git: /usr/local/lib/nagios
|
- git: {{ git_dir }}
|
||||||
- pkg: monitoring_packages
|
- pkg: monitoring_packages
|
||||||
|
|
||||||
venv-ensurepip:
|
venv-ensurepip:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: /usr/local/lib/nagios/venv/bin/python3 -m ensurepip
|
- name: {{ venv_dir }}/bin/python3 -m ensurepip
|
||||||
- creates: /usr/local/lib/nagios/venv/bin/pip3
|
- creates: {{ venv_dir }}/bin/pip3
|
||||||
- require:
|
- require:
|
||||||
- cmd: /usr/local/lib/nagios/venv
|
- cmd: {{ venv_dir }}
|
||||||
|
|
||||||
{#
|
{#
|
||||||
venv-psutil:
|
venv-psutil:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: /usr/local/lib/nagios/venv/bin/pip3 install psutil
|
- name: {{ venv_dir }}/bin/pip3 install psutil
|
||||||
- unless: /usr/local/lib/nagios/venv/bin/pip3 freeze | grep -q '^psutil='
|
- unless: {{ venv_dir }}/bin/pip3 freeze | grep -q '^psutil='
|
||||||
- require:
|
- require:
|
||||||
- cmd: venv-ensurepip
|
- cmd: venv-ensurepip
|
||||||
#}
|
#}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ icingaweb2_vhost:
|
|||||||
- group: root
|
- group: root
|
||||||
- mode: 644
|
- mode: 644
|
||||||
- source: https://packages.icinga.com/icinga.key
|
- source: https://packages.icinga.com/icinga.key
|
||||||
- source_hash: be677e07972ed57b99ffc2fd211379ac11b9c6a7c8d9460086b447b96b0a82bb
|
- source_hash: e2b9301181fcc3cd555323cafbecfcd8764f47e06e14e0128f172c544bbb619f
|
||||||
|
|
||||||
icingacmd:
|
icingacmd:
|
||||||
group.present: []
|
group.present: []
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% from "salt/map.jinja" import salt_daemons with context %}
|
{% from "salt/map.jinja" import salt_daemons with context %}
|
||||||
|
|
||||||
{% if grains['os'] != 'CentOS' %}
|
{% if grains['os'] not in ('CentOS', 'AlmaLinux') %}
|
||||||
{{ raise("Unsupported distro") }}
|
{{ raise("Unsupported distro") }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
salt:
|
salt:
|
||||||
pkgrepo.managed:
|
pkgrepo.managed:
|
||||||
- baseurl: "https://repo.saltproject.io/salt/py3/redhat/{{ grains['osmajorrelease'] }}/x86_64/minor/{{ salt.pillar.get("salt:version") }}"
|
- 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
|
- gpgkey: file:///etc/pki/rpm-gpg/SALT-PROJECT-GPG-PUBKEY-2023
|
||||||
- skip_if_unavailable: true
|
- skip_if_unavailable: true
|
||||||
- failovermethod: priority
|
- failovermethod: priority
|
||||||
|
|||||||
8
setup.sh
8
setup.sh
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SALT_VERSION='3006.4'
|
SALT_VERSION='3007.1'
|
||||||
|
|
||||||
CYAN='\033[1;36m'
|
CYAN='\033[1;36m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
@@ -45,6 +45,7 @@ read
|
|||||||
|
|
||||||
if ! [ -e /usr/bin/salt-call ]; then
|
if ! [ -e /usr/bin/salt-call ]; then
|
||||||
if [[ "$DISTRO" == "fedora" ]]; 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}"
|
echo -e "${CYAN}Fedora detected - installing Python3.10 if not present, then using a venv${NC}"
|
||||||
if ! which python3.10 &>/dev/null; then
|
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
|
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 freeze | grep -q ^salt== ||
|
||||||
/opt/saltstack/salt/bin/pip3 install "salt==$SALT_VERSION"
|
/opt/saltstack/salt/bin/pip3 install "salt==$SALT_VERSION"
|
||||||
ln -sfT /opt/saltstack/salt/bin/salt-call /usr/bin/salt-call
|
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
|
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 ] ||
|
[ -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
|
curl -fsSL -o /etc/yum.repos.d/salt.repo https://repo.saltproject.io/salt/py3/redhat/$OS_VERSION/x86_64/minor/$SALT_VERSION.repo
|
||||||
|
|||||||
Reference in New Issue
Block a user