47 lines
1.4 KiB
Bash
47 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
PUPPET_MASTER='puppet-v2.int.metaunix.net'
|
|
|
|
# determine OS version
|
|
if [ -f '/etc/redhat-release' ]; then
|
|
OS="rhel"
|
|
OSVERSION=$(sed -rn 's/.*release ([0-9]+).*/\1/p' /etc/redhat-release)
|
|
elif [ -f '/etc/debian_version' ]; then
|
|
OS="debian"
|
|
elif [ -d '/etc/ubuntu-advantage' ]; then
|
|
OS="ubuntu"
|
|
else
|
|
OS="freebsd"
|
|
fi
|
|
|
|
read -p 'System hostname: ' HOSTNAME
|
|
read -p 'System domain: ' DOMAIN
|
|
|
|
if [ "$OS" = 'freebsd' ]; then
|
|
# Configure system hostname
|
|
sysrc hostname="$HOSTNAME.$DOMAIN"
|
|
|
|
# Expand file system to match disk's bounds
|
|
gpart recover da0 # run this first in case the disk is corrupted
|
|
camcontrol reprobe da0 # force re-probing of the disk info
|
|
gpart resize -i 3 da0 # re-size the root partition automatically
|
|
zpool online -e zroot da0p3 # make ZFS resize the volume to match
|
|
|
|
# Install Puppet
|
|
echo -e "[agent]\nserver = $PUPPET_MASTER\nruninterval = 6h\n" > /usr/local/etc/puppet/puppet.conf
|
|
sysrc puppet_enable="YES"
|
|
else
|
|
# Configure system hostname
|
|
hostnamectl set-hostname "$HOSTNAME.$DOMAIN"
|
|
|
|
# Grow the partition and filesystem
|
|
growpart /dev/sda 4
|
|
xfs_growfs /
|
|
|
|
# Install and configure Puppet (OpenVox)
|
|
rpm -Uvh "https://yum.voxpupuli.org/openvox8-release-el-$OSVERSION.noarch.rpm"
|
|
dnf install -y openvox-agent
|
|
echo -e "[agent]\nserver = $PUPPET_MASTER\nruninterval = 6h\n" > /etc/puppetlabs/puppet/puppet.conf
|
|
systemctl restart puppet
|
|
fi
|