Create requirements.txt
file:
ansible==7.2.0
ansible-lint==6.10.0
jmespath
dnspython
git+https://github.com/mitogen-hq/mitogen.git@a47b9f3631ba3c37bf0410c6a4960c3eec152454
Create ansible-setup.bash:
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" && pwd -P)
cd "${SCRIPT_DIR}"
# ansible 7.2.0 is ansible-core 2.14.2
ANSIBLE_VERSION=7.2.0
sudo apt update
sudo apt install -y python3-venv
mkdir -p "${HOME}"/.ansible_venv
python3 -m venv "${HOME}"/.ansible_venv/ansible-"${ANSIBLE_VERSION}"
# shellcheck source=/dev/null
source "${HOME}"/.ansible_venv/ansible-"${ANSIBLE_VERSION}"/bin/activate
python3 -m pip install --use-pep517 --upgrade pip setuptools
python3 -m pip install --use-pep517 -r requirements.txt
# Mitogen
sed -i "s/^ANSIBLE_VERSION_MAX = (2, 13)/ANSIBLE_VERSION_MAX = (2, 14)/" $(python3 -c "import sys; print(sys.path.pop())")/ansible_mitogen/loaders.py
Install ansible:
bash ansible-setup.bash
Load ansible python virtualenv and enable mitogen:
. ~/ansible_venv/ansible-7.2.0/bin/activate
export ANSIBLE_STRATEGY_PLUGINS=$(python3 -c "import sys; print(sys.path.pop())")/ansible_mitogen/plugins/strategy
export ANSIBLE_STRATEGY=mitogen_linear