debian.ansible.nextcloud.se.../install.sh

40 lines
1.1 KiB
Bash
Raw Normal View History

2023-08-21 12:08:19 +02:00
#!/bin/bash
set -e
2023-08-21 14:37:21 +02:00
# 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-22 14:37:30 +02:00
# add user to sudo group it not
if ! id | grep -q '(sudo)'
then
su -c "/usr/sbin/usermod -a -G sudo ${USER}"
2023-08-22 14:53:14 +02:00
# use sudo group and restart this script
2023-08-22 15:00:32 +02:00
exec sg sudo -c "bash $0"
2023-08-22 14:53:14 +02:00
exit $?
2023-08-22 14:37:30 +02:00
fi
2023-08-21 14:37:21 +02:00
2023-08-21 15:58:27 +02:00
2023-08-21 14:52:09 +02:00
sudo apt-get -y install ansible git
2023-08-21 15:58:27 +02:00
sudo ansible-galaxy collection install community.general
2023-08-21 14:51:46 +02:00
#sudo apt-get -y install python3-pip git
#sudo pip install ansible
2023-08-21 12:08:19 +02:00
cd
rm -rf $(hostname -s)-git
mkdir $(hostname -s)-git
cd $(hostname -s)-git
for playbook in \
debian.ansible.basics \
debian.ansible.runchecks \
debian.ansible.backup \
debian.ansible.autoupdate \
debian.ansible.dedyn.client \
debian.ansible.docker \
debian.ansible.traefik.server \
debian.ansible.firewall \
debian.ansible.nextcloud.server
do
git clone https://gitea.ds9.dedyn.io/olli/${playbook}.git
sudo ansible-playbook --connection=local --inventory $(hostname), --limit $(hostname) ${playbook}/*.yml
done