Sign inSign up

willhallonline/ansible-test

By willhallonline

•Updated 6 days ago

Ansible testing inside Docker.

Image
1

100K+

willhallonline/ansible-test repository overview

⁠Ansible Testing

This image is to test the functionality of Ansible from within a container. It is aimed at being used only with CI tests of Ansible roles or playbooks.

Docker Pulls

⁠Ansible 2.10
⁠Ansible 2.9

⁠Using Mitogen

To leverage Mitogen to accelerate your playbook runs, add this to your ansible.cfg:

Please investigate in your container the location of ansible_mitogen (it is different per container). You can do this via:

your_container="ansible:latest"
docker run --rm -it "willhallonline/${your_container}" /bin/sh -c "find / -type d | grep "ansible_mitogen/plugins" | sort | head -n 1"

and then configuring your own ansible.cfg like:

[defaults]
strategy_plugins = /usr/local/lib/python3.7/site-packages/ansible_mitogen/plugins/
strategy = mitogen_linear

⁠Running

You will likely need to mount required directories into your container to make it run (or build on top of what is here).

⁠Simple
$   docker run --rm -it willhallonline/ansible-test:latest /bin/sh
⁠Mount local directory and ssh key
$   docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/root/id_rsa willhallonline/ansible-test:latest /bin/sh
⁠Injecting commands
$   docker run --rm -it -v $(pwd):/ansible -v ~/.ssh/id_rsa:/root/id_rsa willhallonline/ansible-test:latest ansible-playbook playbook.yml

⁠Maintainer

Tag summary

Content type

Image

Digest

sha256:4331a8cd1…

Size

340.5 MB

Last updated

6 days ago

docker pull willhallonline/ansible-test