diff --git a/devcontainer/features/src/ansible/install.sh b/devcontainer/features/src/ansible/install.sh index b18f0bed..f728261a 100755 --- a/devcontainer/features/src/ansible/install.sh +++ b/devcontainer/features/src/ansible/install.sh @@ -1,14 +1,36 @@ #!/bin/sh set -e +# Disable Globbing +set -f + +# +# Gather & Install Required Packages +# + +# This will contain all the packages we need to install; space seperated. +packages="gnupg2" if [ -f requirements.txt ]; then # Install pip to install ansible & kubernetes modules if ! command -v pip; then - sudo apt update - sudo apt install -y --no-install-recommends python3-pip - else - echo "Pip already installed" + packages="$packages python3-pip" fi +fi + +# sshpass for initial node provisioning +if ! command -v sshpass; then + packages="$packages sshpass" +fi + +sudo apt-get update +# shellcheck disable=SC2086 +sudo apt-get install -y --no-install-recommends $packages + +# +# Non-Package Requirements +# + +if [ -f requirements.txt ]; then pip install -r requirements.txt else echo "No requirements.txt found" @@ -20,9 +42,3 @@ if [ -f requirements.yml ]; then else echo "No requirements.yml found" fi - -# sshpass for initial node provisioning -if ! command -v sshpass; then - sudo apt update - sudo apt install -y --no-install-recommends sshpass -fi \ No newline at end of file