now allowing the user to provide the path to a playbook to speed up the

installation process
This commit is contained in:
aminnairi
2024-01-04 12:24:49 +01:00
parent 9bff80c0f9
commit 17c7ceeec6
+7
View File
@@ -4,6 +4,7 @@ ERROR_BECAUSE_ROOT=1
ERROR_BECAUSE_NOT_ARCH_LINUX=2 ERROR_BECAUSE_NOT_ARCH_LINUX=2
ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=3 ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=3
ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND=4 ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND=4
ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=5
if [[ "$(id -u)" -eq 0 ]] if [[ "$(id -u)" -eq 0 ]]
then then
@@ -60,6 +61,12 @@ then
exit $ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND exit $ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND
fi fi
if [[ ! -f $choosen_playbook_path ]]
then
echo "Error: playbook path $choosen_playbook_path does not exist on the file system."
exit $ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST
fi
echo "Installing needed Ansible packages..." echo "Installing needed Ansible packages..."
ANSIBLE_COLLECTIONS_PATH="$PWD/ansible/collections" ansible-galaxy collection install --collections-path ansible/collections --requirements-file ansible/galaxy/requirements.yml ANSIBLE_COLLECTIONS_PATH="$PWD/ansible/collections" ansible-galaxy collection install --collections-path ansible/collections --requirements-file ansible/galaxy/requirements.yml