Added a script to run on initial system setup
This commit is contained in:
parent
e342cea6ef
commit
060c35058d
@ -74,4 +74,9 @@ build {
|
||||
"scripts/remove-snap.sh"
|
||||
]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
source = "scripts/initial-setup.sh"
|
||||
destination = "/home/xadmin/initial-setup.sh"
|
||||
}
|
||||
}
|
||||
|
33
scripts/initial-setup.sh
Normal file
33
scripts/initial-setup.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
SALT_MASTER='salt-v1.int.metaunix.net'
|
||||
|
||||
# determine OS version
|
||||
if [ -f '/etc/redhat-release' ]; then
|
||||
OS="debian"
|
||||
elif [ -f '/etc/debian-release' ]; then
|
||||
OS="rhel"
|
||||
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
|
||||
echo "$HOSTNAME.$DOMAIN" > /usr/local/etc/salt/minion_id
|
||||
sed -i .orig "s/\#master: salt/master: $SALT_MASTER/" /usr/local/etc/salt/minion
|
||||
rm -rf /usr/local/etc/salt/pki
|
||||
|
||||
sysrc salt_minion_enable="YES"
|
||||
service salt_minion start
|
||||
else
|
||||
echo "$HOSTNAME.$DOMAIN" > /etc/salt/minion_id
|
||||
sed -i "s/\#master: salt/master: $SALT_MASTER/" /etc/salt/minion
|
||||
rm -rf /etc/salt/pki
|
||||
|
||||
systemctl enable salt-minion
|
||||
systemctl start salt-minion
|
||||
fi
|
Loading…
Reference in New Issue
Block a user