Setup salt provisioning

This commit performs salt provisioning setup by adding salt master to
the salt VM and salt minion to all VMs. An /etc/hosts entry for the salt
master is added using a shell provisioner. No salt executions are
performed yet.
This commit is contained in:
Jan Dittberner 2017-02-18 13:29:18 +01:00
parent f373d0c639
commit d1cecfe7a8
3 changed files with 41 additions and 2 deletions

View file

@ -0,0 +1,22 @@
#!/bin/sh
set -e
ip_address="172.16.4.10"
host_name="salt.gva.dev"
matches_in_host="$(grep -n $host_name /etc/hosts | cut -f1 -d:)"
host_entry="${ip_address} ${host_name} salt"
if [ ! -z "$matches_in_host" ]
then
echo "Updating existing hosts entry"
echo $matches_in_host | while read -r line_number; do
sed -i "${line_number}s/.*/${host_entry}/" /etc/hosts
done
else
echo "Adding new hosts entry"
echo "${host_entry}" >> /etc/hosts
fi