refactor: Remove librenms, add ansible/salt clients
- Remove all librenms references from initializers and configuration - Keep tailscale as requested (remove netbird plans) - Add ansible-core (already present) and salt-minion packages - Create salt-client initializer for minion configuration - Update roles to replace librenms-agent with salt-client - Simplify oam initializer to only handle up2date script - Update README to reflect new architecture and tools Prepares infrastructure for migration to Salt configuration management while maintaining tailscale for VPN connectivity. 💘 Generated with Crush Assisted-by: GLM-4.6 via Crush <crush@charm.land>
This commit is contained in:
96
initializers/system-config/apply
Executable file
96
initializers/system-config/apply
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
# KNEL System Configuration Initializer
|
||||
# Applies system-wide configuration files with conditional logic
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "Running system configuration initializer..."
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p $ROOT_SSH_DIR
|
||||
|
||||
# Deploy system configuration files from copied templates
|
||||
if [[ -f ./ConfigFiles/ZSH/tsys-zshrc ]]; then
|
||||
cp ./ConfigFiles/ZSH/tsys-zshrc /etc/zshrc
|
||||
fi
|
||||
|
||||
if [[ -f ./ConfigFiles/SMTP/aliases ]]; then
|
||||
cp ./ConfigFiles/SMTP/aliases /etc/aliases
|
||||
newaliases
|
||||
fi
|
||||
|
||||
if [[ -f ./ConfigFiles/Syslog/rsyslog.conf ]]; then
|
||||
cp ./ConfigFiles/Syslog/rsyslog.conf > /etc/rsyslog.conf
|
||||
fi
|
||||
|
||||
# Configure DHCP client
|
||||
if [[ -f ./ConfigFiles/DHCP/dhclient.conf ]]; then
|
||||
cp ./ConfigFiles/DHCP/dhclient.conf > /etc/dhcp/dhclient.conf
|
||||
fi
|
||||
|
||||
# Configure SNMP
|
||||
systemctl stop snmpd 2>/dev/null || true
|
||||
/etc/init.d/snmpd stop 2>/dev/null || true
|
||||
|
||||
if [[ -f ./ConfigFiles/SNMP/snmp-sudo.conf ]]; then
|
||||
cp ./ConfigFiles/SNMP/snmp-sudo.conf > /etc/sudoers.d/Debian-snmp
|
||||
fi
|
||||
|
||||
# Adjust SNMP service for log verbosity
|
||||
sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service
|
||||
|
||||
# Configure SNMP based on system type (with pi-detect)
|
||||
if command -v vcgencmd >/dev/null 2>&1; then
|
||||
export IS_RASPI="1"
|
||||
else
|
||||
export IS_RASPI="0"
|
||||
fi
|
||||
|
||||
if [[ $IS_RASPI -eq 1 ]] && [[ -f ./ConfigFiles/SNMP/snmpd-rpi.conf ]]; then
|
||||
cp ./ConfigFiles/SNMP/snmpd-rpi.conf /etc/snmp/snmpd.conf
|
||||
elif [[ $IS_PHYSICAL_HOST -eq 1 ]] && [[ -f ./ConfigFiles/SNMP/snmpd-physicalhost.conf ]]; then
|
||||
cp ./ConfigFiles/SNMP/snmpd-physicalhost.conf /etc/snmp/snmpd.conf
|
||||
elif [[ $IS_VIRT_GUEST -eq 1 ]] && [[ -f ./ConfigFiles/SNMP/snmpd.conf ]]; then
|
||||
cp ./ConfigFiles/SNMP/snmpd.conf /etc/snmp/snmpd.conf
|
||||
fi
|
||||
|
||||
# Configure lldpd
|
||||
if [[ -f ./ConfigFiles/NetworkDiscovery/lldpd ]]; then
|
||||
cp ./ConfigFiles/NetworkDiscovery/lldpd /etc/default/lldpd
|
||||
systemctl restart lldpd
|
||||
fi
|
||||
|
||||
# Configure Cockpit
|
||||
if [[ -f ./ConfigFiles/Cockpit/disallowed-users ]]; then
|
||||
cp ./ConfigFiles/Cockpit/disallowed-users /etc/cockpit/disallowed-users
|
||||
systemctl restart cockpit
|
||||
fi
|
||||
|
||||
# Configure NTP for non-NTP servers
|
||||
if [[ $NTP_SERVER_CHECK -eq 0 ]] && [[ -f ./ConfigFiles/NTP/ntp.conf ]]; then
|
||||
cp ./ConfigFiles/NTP/ntp.conf /etc/ntpsec/ntp.conf
|
||||
systemctl restart ntpsec.service
|
||||
fi
|
||||
|
||||
# Always install rsyslog (removed librenms conditional)
|
||||
DEBIAN_FRONTEND="noninteractive" apt-get -qq --yes -o Dpkg::Options::="--force-confold" install rsyslog
|
||||
systemctl stop rsyslog
|
||||
systemctl start rsyslog
|
||||
|
||||
# Reload systemd and restart SNMP
|
||||
systemctl daemon-reload
|
||||
systemctl restart snmpd 2>/dev/null || true
|
||||
/etc/init.d/snmpd restart 2>/dev/null || true
|
||||
|
||||
# Performance tuning based on system type
|
||||
if [[ $IS_PHYSICAL_HOST -gt 0 ]]; then
|
||||
cpufreq-set -r -g performance
|
||||
cpupower frequency-set --governor performance
|
||||
fi
|
||||
|
||||
if [[ $IS_VIRT_GUEST -eq 1 ]]; then
|
||||
tuned-adm profile virtual-guest
|
||||
fi
|
||||
|
||||
echo "System configuration initializer completed"
|
||||
Reference in New Issue
Block a user