Skip to content

Instantly share code, notes, and snippets.

@ishad0w
Last active November 17, 2024 15:10
Show Gist options
  • Save ishad0w/d85eb434be256b9fd90979b593e4630c to your computer and use it in GitHub Desktop.
Save ishad0w/d85eb434be256b9fd90979b593e4630c to your computer and use it in GitHub Desktop.
Ansible with Mitogen (venv) for macOS / Linux

Ansible with Mitogen (venv) for macOS / Linux

  1. Download the script
wget https://gist.githubusercontent.com/ishad0w/d85eb434be256b9fd90979b593e4630c/raw/ansible-with-mitogen-venv-install.sh
  1. Make it executable
chmod +x ansible-with-mitogen-venv-install.sh
  1. Run it
./ansible-with-mitogen-venv-install.sh
  1. Add the PATH to your .profile or .zshrc / .bashrc
export PATH="$HOME/.venvs/ansible-mitogen/abin:$PATH"
  1. Enjoy!
#!/bin/bash
python3 -m venv ~/.venvs/ansible-mitogen
source ~/.venvs/ansible-mitogen/bin/activate
pip install --upgrade \
pip cffi jmespath \
boto3 pywinrm \
mitogen==0.3.18 \
ansible-core==2.17.6 \
ansible==10.6.0 \
ansible-lint==24.9.2
mkdir -p ~/.venvs/ansible-mitogen/abin/
ln -s ~/.venvs/ansible-mitogen/bin/ansible* ~/.venvs/ansible-mitogen/abin/
mitogen_path=$(find $(python -c "import site; print(site.getsitepackages()[0])") -type d -name 'ansible_mitogen' | head -n 1)/plugins/strategy && echo $mitogen_path
cat <<EOL > ~/.ansible.cfg
[defaults]
strategy_plugins = $mitogen_path
strategy = mitogen_linear
EOL
export PATH="$HOME/.venvs/ansible-mitogen/abin:$PATH"
cat ~/.ansible.cfg
ansible --version
ansible-playbook --version
deactivate
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment