From 17c7ceeec61b7c4294d2aab6cff755f2b4f2e9e2 Mon Sep 17 00:00:00 2001 From: aminnairi <18418459+aminnairi@users.noreply.github.com> Date: Thu, 4 Jan 2024 12:24:49 +0100 Subject: [PATCH] now allowing the user to provide the path to a playbook to speed up the installation process --- main.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.sh b/main.sh index 34ab89f..a4afdf5 100755 --- a/main.sh +++ b/main.sh @@ -4,6 +4,7 @@ ERROR_BECAUSE_ROOT=1 ERROR_BECAUSE_NOT_ARCH_LINUX=2 ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=3 ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND=4 +ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=5 if [[ "$(id -u)" -eq 0 ]] then @@ -60,6 +61,12 @@ then exit $ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND 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..." ANSIBLE_COLLECTIONS_PATH="$PWD/ansible/collections" ansible-galaxy collection install --collections-path ansible/collections --requirements-file ansible/galaxy/requirements.yml