summaryrefslogtreecommitdiffstats
path: root/tools/install-reqs.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtools/install-reqs.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/install-reqs.sh b/tools/install-reqs.sh
new file mode 100755
index 0000000..d4f3624
--- /dev/null
+++ b/tools/install-reqs.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -euo pipefail
+pushd examples/playbooks/collections >/dev/null
+MISSING=()
+export ANSIBLE_COLLECTIONS_PATH=.
+for COLLECTION in ansible.posix community.general community.molecule;
+do
+ COL_NAME=${COLLECTION//\./-}
+ FILENAME=$(find . -maxdepth 1 -name "$COL_NAME*" -print -quit)
+ if test -n "$FILENAME"
+ then
+ echo "Already cached $COL_NAME as $FILENAME"
+ else
+ MISSING+=("${COLLECTION}")
+ fi
+ if [ ${#MISSING[@]} -ne 0 ]; then
+ ansible-galaxy collection download -p . -v "${MISSING[@]}"
+ fi
+done
+
+echo "Install requirements.yml ..."
+ansible-galaxy collection install *.tar.gz -p .
+ansible-galaxy collection list
+popd >/dev/null