Ansible inside Docker for consistent running of ansible inside your local machine or CI/CD system.
Dockerfile linksThis is my preferred install variant mainly due to the performance improvements that Mitogen awards you. You can read more about it inside the Mitogen for Ansible documentation.
**You will likely need to mount required directories into your container to make it run (or build on top of what is here).
$~ docker run --rm -it tomxiong/ansible /bin/sh
$~ docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/root/id_rsa tomxiong/ansible:2.8 /bin/sh
$~ docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/root/id_rsa tomxiong/ansible:2.8 ansible-playbook playbook.yml
You can put these inside your dotfiles (~/.bashrc or ~/.zshrc to make handy aliases).
alias docker-ansible-cli='docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/root/.ssh/id_rsa --workdir=/ansible tomxiong/ansible:2.8-alpine /bin/sh'
alias docker-ansible-cmd='docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/root/.ssh/id_rsa --workdir=/ansible tomxiong/ansible:2.8-alpine '
use with:
$~ docker-ansible-cli ansible-playbook -u playbook.yml
Content type
Image
Digest
Size
73.4 MB
Last updated
over 6 years ago
docker pull tomxiong/ansible