/skrypty/infra/propagate_etc_hosts.sh
#!/bin/bash
for i in `virsh list --all | grep running | awk '{print $2}'` ; do
scp /etc/hosts $i:/etc/hosts
done
/skrypty/infra/zneta.sh
#!/bin/bash
# skrypt bierze input z pliku i szuka linijek w obecnym konfigu i zamienia je
# linijka jest z inna wartoscia - zastepuja ja
# linijki nie ma - dodaje na koncu pliku
# check if all required variables are placed in syntax
if [ -z $1 ] || [ -z $2 ]; then
echo '$1 - plik config, $2 - plik z nowym inputem'
exit
else
echo "variables ok"
fi
# read input file with desired values
while read line; do
# line (but only parameter, not value) exists in current config - print existing value
# get pattern to search from input file. Parameter only, without valye
pattern=`echo $line | awk '{print $1}'`
echo "pattern to $pattern"
# test pattern against file
grep "^$pattern" "$1" > /dev/null 2>&1
if [ "$?" = 0 ]; then
echo "pattern found, printing current config : `grep "^\$pattern" $1`"
echo "will be replaced with: `echo $line`"
sed -i "s:^$pattern.*:$line:g" $1 && echo "change made"
#n) continue ;;
#*) echo "answer y/n)" ;;
#esac
else
echo "no line in config, adding to end of file"
echo "$line" >> $1
fi
done < $2
/skrypty/infra/install_nfs_server.sh
#!/bin/bash
yum groupinstall -y file-server
firewall-cmd --permanent --add-service=nfs
firewall-cmd --reload
systemctl enable rpcbind nfs-server
systemctl start rpcbind nfs-server
/skrypty/infra/ldap_client_install.sh
#!/bin/sh
authconfig --enableldap \
--enableldapauth \
--ldapserver=ldap.example.com \
--ldapbasedn="dc=example,dc=com" \
--enablemkhomedir \
--update
/skrypty/infra/infra_change_timezone.sh
#!/bin/bash
while read line; do
i=$(echo $line | awk '{print $1}')
j=$(echo $line | awk '{print $2}')
echo -e "\r"
echo $i
echo -e "\r"
ssh -n $i "sudo su -c \"
/etc/init.d/ntpd stop
cp -p /etc/sysconfig/clock /etc/sysconfig/clock_backup
sed -i -e 's/^ZONE=.*/ZONE=\\\"$j\\\"/g' /etc/sysconfig/clock
mv /etc/localtime /etc/localtime_backup
ln -s /usr/share/zoneinfo/$j /etc/localtime
/etc/init.d/ntpd start \""
done < list
/skrypty/infra/post_install.sh
#!/bin/bash