diff --git a/scripts/salt_pillar_apache_sample.sh b/scripts/salt_pillar_apache_sample.sh new file mode 100644 index 0000000..512415f --- /dev/null +++ b/scripts/salt_pillar_apache_sample.sh @@ -0,0 +1,124 @@ +#!/bin/sh + +# Author: Pekka Helenius (~Fincer), 2018 +# +# - This script creates two different apache configurations for two minions: minion_1 & minion_2 +# - This script is meant to be run on Salt master +# +# Default site contents for all minions is: Nothing interesting here +# minion_2 gets contents of 'uname -a' command into the index.html page +# + +if [ $(id -u) -eq 0 ]; then + + mkdir -p /srv/{pillar,salt/apache} + +if [ ! -f /srv/pillar/top.sls ]; then +tee /srv/pillar/top.sls < + ServerName {{ (grains['os'].lower() + '.' + grains['id'] + '.com') }} + ServerAlias {{ ('www.' + grains['os'].lower() + '.' + grains['id'] + '.com') }} + ServerAdmin webmaster@localhost + DocumentRoot {{ ('/var/www/html/' + grains['id'] + '/') }} + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + +SAMPLE_SITE + +tee /srv/salt/apache/sampleindex.html <