2023-08-21 16:04:03 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# on fresh install remove cdrom-repo and install sudo if not available
|
|
|
|
which sudo >/dev/null 2>&1 || su -c "sed -i '/cdrom/d' /etc/apt/sources.list ; apt update ; apt -y install sudo"
|
2023-08-23 14:05:25 +02:00
|
|
|
# add user to sudo group it not
|
|
|
|
if ! id | grep -q '(sudo)'
|
|
|
|
then
|
|
|
|
su -c "/usr/sbin/usermod -a -G sudo ${USER}"
|
|
|
|
# use sudo group and restart this script
|
|
|
|
exec sg sudo -c "bash $0"
|
|
|
|
exit $?
|
|
|
|
fi
|
2023-08-21 16:04:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
sudo apt-get -y install ansible git
|
|
|
|
sudo ansible-galaxy collection install community.general
|
|
|
|
#sudo apt-get -y install python3-pip git
|
|
|
|
#sudo pip install ansible
|
|
|
|
|
|
|
|
cd
|
|
|
|
rm -rf $(hostname -s)-git
|
|
|
|
mkdir $(hostname -s)-git
|
|
|
|
cd $(hostname -s)-git
|
|
|
|
|
2023-08-23 14:05:25 +02:00
|
|
|
|
2023-08-21 16:04:03 +02:00
|
|
|
for playbook in \
|
|
|
|
debian.ansible.basics \
|
|
|
|
debian.ansible.runchecks \
|
|
|
|
debian.ansible.autoupdate \
|
|
|
|
debian.ansible.dedyn.client
|
|
|
|
do
|
|
|
|
git clone https://gitea.ds9.dedyn.io/olli/${playbook}.git
|
|
|
|
sudo ansible-playbook --connection=local --inventory $(hostname), --limit $(hostname) ${playbook}/*.yml
|
|
|
|
done
|