#!/bin/bash known=( *.org ) fknown=(`sudo /usr/bin/func '*' list_minions`) function funcunknownhost() { if [ -z "$1" ] then return fi for i in ${fknown[@]} do if [ $i == $1 ] then return 1 fi done return 0 } #make the new ones for host in ${fknown[@]} do if [ ! -d $host ]; then mkdir $host for fn in init run-puppet yum.conf.include do touch $host/$fn git add $host/$fn done fi done #clean up the old ones for host in ${known[@]} do if funcunknownhost $host; then echo "removing $host - gone from puppet/func" git rm -r $host fi done