Add provision.sh

This commit is contained in:
Sam Al-Sapti 2023-04-18 15:46:11 +02:00
parent d75dc208c8
commit a2c3219ed0
Signed by: samsapti
GPG Key ID: CBBBE7371E81C4EA
2 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,3 @@
[defaults]
remote_user = root
inventory = inventory
use_persistent_connections = True

16
ansible/provision.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env sh
BASE_CMD="ansible-playbook playbook.yml -i inventory --ask-vault-pass"
if [ -z "$(ansible-galaxy collection list community.general 2>/dev/null)" ]; then
ansible-galaxy collection install community.general
fi
case $1 in
root)
$BASE_CMD -u root ;;
user)
$BASE_CMD --ask-become-pass -u mpc-player ;;
*)
exit 1 ;;
esac