From a2c3219ed002ba8d92ed6adb6f1a4ca34fa813cf Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 18 Apr 2023 15:46:11 +0200 Subject: [PATCH] Add provision.sh --- ansible/ansible.cfg | 1 - ansible/provision.sh | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 ansible/provision.sh diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 0171008..277b5c9 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -1,4 +1,3 @@ [defaults] -remote_user = root inventory = inventory use_persistent_connections = True diff --git a/ansible/provision.sh b/ansible/provision.sh new file mode 100755 index 0000000..2809d93 --- /dev/null +++ b/ansible/provision.sh @@ -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