From edf65b7760e9ce06b7796f502c24460b9b7920c7 Mon Sep 17 00:00:00 2001 From: nemo Date: Sun, 24 Mar 2019 16:15:32 +0100 Subject: [PATCH] Add dedicated file for context variables --- recipe_gentoo.sh | 63 +----------------------------------------------- vars.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 62 deletions(-) create mode 100644 vars.sh diff --git a/recipe_gentoo.sh b/recipe_gentoo.sh index d661fb5..e66f570 100755 --- a/recipe_gentoo.sh +++ b/recipe_gentoo.sh @@ -8,45 +8,11 @@ BLUE='\033[1;34m' GREEN='\033[1;32m' NC='\033[0m' # No Color -# Packages to check -PACKAGES=( -# 'virtual/ssh' -# 'app-admin/rsyslog' -# 'net-misc/ntp' -# 'net-analyzer/icinga2' -# 'app-backup/borgbackup' -# 'virtual/cron' -# 'sys-process/cronie' -# 'net-analyzer/munin' -# 'app-admin/sysklogd' -# 'dev-vcs/git' -# 'net-analyzer/nrpe' -# 'net-analyzer/net-snmp' -# 'net-dns/bind-tools' -# 'dev-vcs/git' -# 'mail-mta/postfix' -# 'mail-mta/eeeepostfix' - ) - -# Package to check if it's a physical machine -PACKAGES_PHYSICAL=( - 'sys-apps/smartmontools' - ) +. vars.sh # Print packages not installed or with error at end script PACKAGES_TO_CHECK="" -NAMES_TO_RESOLV_AND_PING=( - 'grifon.fr' - 'arn-fai.net' - 'grifonfesfdsfdsf.fr' - ) - -RESOLVERS=( - '2a00:5884::7' - '89.234.186.4' - ) - RESOLV_FAILED="" RESOLVER_NOT_IN_ETC_RESOLVCONF="" @@ -55,34 +21,9 @@ IP_NOT_RECORDED_IN_DNS="" PING_FAILED="" -SERVICES_TO_CHECK=( - 'rsyslog' - 'ntpd' - 'munin-node' - 'iptables' - 'ip6tables' - 'sshd' - 'postfix' - 'nrpe' - 'snmpd' - 'hostname' - ) - -SERVICES_TO_CHECK_PHYSICAL=( - 'smard' - ) - # Get ALL locales IPs except loopback LOCALES_IP_WITHOUT_LOOPBACK=$(ip a |grep inet |grep -v 'fe80\|127.0.0.1\|::1/128'| tr -s " " |cut -f3 -d' '| cut -d\/ -f1) -IPV4_ADMIN_NETWORK="172.18.0." -IPV6_ADMIN_NETWORK="fd01:1e02:40:" - -IPV4_MASTER_MUNIN='^172\\\.18\\\.0\\\.13\$' -IPV6_MASTER_MUNIN='^fd01:1e02:40::3\$' -IPV4_MASTER_MUNIN_PRINT='^172\.18\.0\.13$' -IPV6_MASTER_MUNIN_PRINT='^fd01:1e02:40::3$' - BOOL_ADMIN_IPV4_NOT_CONFIGURED=0 BOOL_ADMIN_IPV6_NOT_CONFIGURED=0 @@ -97,8 +38,6 @@ NRPE_CONFIG_CHECK_FAILED="" MUNIN_CONFIG_CHECK_FAILED="" MAIL_ALIAS_CONFIG_CHECK_FAILED="" -MAIL_ALIAS_ROOT="admin@grifon.fr" - usage() { printf "Usage: ./recipe_gentoo.sh [--physical]\n" printf "option : \t-P, --physical : if the current server is not a VM but a physical machine\n" diff --git a/vars.sh b/vars.sh new file mode 100644 index 0000000..fd22bbc --- /dev/null +++ b/vars.sh @@ -0,0 +1,63 @@ +# Packages to check +PACKAGES=( +# 'virtual/ssh' +# 'app-admin/rsyslog' +# 'net-misc/ntp' +# 'net-analyzer/icinga2' +# 'app-backup/borgbackup' +# 'virtual/cron' +# 'sys-process/cronie' +# 'net-analyzer/munin' +# 'app-admin/sysklogd' +# 'dev-vcs/git' +# 'net-analyzer/nrpe' +# 'net-analyzer/net-snmp' +# 'net-dns/bind-tools' +# 'dev-vcs/git' +# 'mail-mta/postfix' +# 'mail-mta/eeeepostfix' + ) + +# Package to check if it's a physical machine +PACKAGES_PHYSICAL=( + 'sys-apps/smartmontools' + ) + +NAMES_TO_RESOLV_AND_PING=( + 'grifon.fr' + 'arn-fai.net' + 'grifonfesfdsfdsf.fr' + ) + +RESOLVERS=( + '2a00:5884::7' + '89.234.186.4' + ) + +SERVICES_TO_CHECK=( + 'rsyslog' + 'ntpd' + 'munin-node' + 'iptables' + 'ip6tables' + 'sshd' + 'postfix' + 'nrpe' + 'snmpd' + 'hostname' + ) + +SERVICES_TO_CHECK_PHYSICAL=( + 'smard' + ) + +IPV4_ADMIN_NETWORK="172.16.0." +IPV6_ADMIN_NETWORK="fd06:1e02:40:" + +IPV4_MASTER_MUNIN='^172\\\.16\\\.0\\\.13\$' +IPV6_MASTER_MUNIN='^fd06:1e02:40::3\$' +IPV4_MASTER_MUNIN_PRINT='^172\.16\.0\.13$' +IPV6_MASTER_MUNIN_PRINT='^fd06:1e02:40::3$' + +MAIL_ALIAS_ROOT="admin6@grifon.fr" +