This Docker image allows to run Ansible from a Linux container. It supports Linux, Windows and MacOS target hosts.
docker build -t ansible-linux-docker:latest .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/hostsMount the ansible folder and run the container interactively:
docker run --rm -v $PWD/ansible:/etc/ansible -ti ansible-linux-docker:latest bash