summaryrefslogtreecommitdiffstats
path: root/tools/install-reqs.sh
blob: d4f3624a5b2c71f81a9a8481e1c7fabd51112e09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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