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