#!/bin/bash set -e source /etc/os-release if [[ $ID = "amzn" ]]; then amazon-linux-extras enable python3.8 yum clean metadata yum install -y \ gcc \ libpq-devel \ python2-pip \ python38 \ python38-pip \ python38-devel \ python-lxml else # FIXME: Currently assumes Debian-based apt-get update && \ apt-get install -y \ libpq-dev \ python3-dev \ python3-pip fi export PATH=/usr/local/bin:$PATH export PIP_DEFAULT_TIMEOUT=60 echo "Installing pipenv..." pip3 install pipenv echo "Installing ansible and dependencies..." PIPENV_NOSPIN=1 PIPENV_HIDE_EMOJIS=1 pipenv sync 2>&1 | iconv -c -f utf-8 -t ascii if [[ $1 == "--dev" ]]; then pipenv sync --dev fi echo "Installing collections from galaxy..." galaxy_retry_count=0 until [[ $galaxy_retry_count -gt 2 ]]; do pipenv run ansible-galaxy collection install --upgrade --verbose --requirements-file requirements.yml && break galaxy_retry_count=$((galaxy_retry_count + 1)) done