#!/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 {{ servername }} ServerAlias {{ serveralias }} 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 <