Awesome
Ansible Linux Docker image
This Docker image allows to run Ansible from a Linux container. It supports Linux, Windows and MacOS target hosts.
Build the image
docker build -t ansible-linux-docker:latest .
Run the container
Mount the ansible
folder containing:
ansible.cfg
: Ansible default configurationhosts
: Hosts inventoryplaybook.yml
: Ansible playbook
and execute the ansible-playbook
command:
docker run --rm -v $PWD/ansible:/etc/ansible ansible-linux-docker:latest ansible-playbook /etc/ansible/playbook.yml -i /etc/ansible/hosts
Mount the ansible
folder and run the container interactively:
docker run --rm -v $PWD/ansible:/etc/ansible -ti ansible-linux-docker:latest bash