If you need consistant way to run Ansible on Mac, Linux and Windows you'll face a surprise! Ansible is not supported on Windows - https://docs.ansible.com/ansible/latest/os_guide/windows_faq.html#can-ansible-run-on-windows
Sad, right? But if you're doing tool like DevOps Pass, you need it.
So I was inspired by OpenTofu's tenv and created my own Ansible Version Manager, which allows you to run Ansible from Windows host, like on Mac or Linux.
Whats behind?
It uses Docker under the hood and allowing you to run Ansible tools from your local without installation of Python (on Mac/Linux) and on Windows.
It is running Docker container, pushing all your local environment variables related to Ansible, Molecule, SSH, AWS, Azure and GCP configuration.
๐ Installation
MacOS / Linux
# Linux
curl -sL $(curl -s https://api.github.com/repos/devopspass/dop-avm/releases/latest | grep "https.*linux_amd64" | awk '{print $2}' | sed 's/"//g') | tar xzvf - dop-avm
# MacOS
curl -sL $(curl -s https://api.github.com/repos/devopspass/dop-avm/releases/latest | grep "https.*darwin_amd64" | awk '{print $2}' | sed 's/"//g') | tar xzvf - dop-avm
sudo mv dop-avm /usr/local/bin/
sudo sh -c "cd /usr/local/bin/ && dop-avm setup"
Windows
Download latest binary for Windows - https://github.com/devopspass/dop-avm/releases/
tar xzf dop-avm*.tar.gz
md %USERPROFILE%\bin
move dop-avm.exe %USERPROFILE%\bin\
setx PATH "%USERPROFILE%\bin;%PATH%"
cd %USERPROFILE%\bin\
dop-avm setup
DevOps Pass AI
In DOP you can add Ansible app and run action Install Ansible Version Manager, it will download and install dop-avm
.
๐ค How it works?
dop-avm
copying own binary with different names, which will be used later by user:
- ansible
- ansible-playbook
- ansible-galaxy
- ansible-vault
- ansible-doc
- ansible-config
- ansible-console
- ansible-inventory
- ansible-adhoc
- ansible-lint
- molecule
When you're running any of this command, it will run Docker container devopspass/ansible:latest
and binary inside (source Dockerfile in repo).
AVM will pass environment variables from host machine:
ANSIBLE_*
MOLECULE_*
GALAXY_*
AWS_*
GOOGLE_APPLICATION_CREDENTIALS
Plus volumes (if exist):
.ssh
.aws
.azure
.ansible
And services, like SSH-agent and Docker socket.
As a result you can run Ansible on Windows, MacOS and Linux via Docker without installation of Python and Ansible on your local, especially it's useful for Windows where it's not possible to run Ansible at all.
๐ณ Use another Docker container
Probably you may have Docker container built in your organization, which is used in pipelines or recommended for local, you can use it by specifying DOP_AVM_IMAGE_NAME
environment variable. Be sure that all necessary binaries, like molecule
are inside, when you're running it.
Support Us, Contact Us
If you like this post, support us, download, try and give us feedback!
Give us a star ๐ on GitHub or join our community on Slack.
Top comments (0)