Skip to content

Docker Ansible container to launch and test playbooks on Windows

Notifications You must be signed in to change notification settings

4emodan/docker-ansible-control

Repository files navigation

Docker Ansible image

This repo follows the solution described in Phil Misiowiec's article to run playbooks inside a Docker container and test them against another dedicated container.

Two things added to the solution - a wrapper script (ssh-keys-ansible-playbook.sh) and run scripts (ansible-control-run.sh and ansible-control-test.sh).

Run scripts added to overcome Docker restrictions on Windows:

  • There are issues with shared folders on Windows. Docker shares C:\Users folder by default, so all Ansible files need to be copied there.
  • Shared folder is created with a random name each time. Docker doesn't see updated content otherwise.
  • SSH keys being copied from ~/.ssh into the shared folder

Wrapper script needed to apply SSH keys inside the container and start ssh-agent to enable ssh-agent forwarding. Sufficient SSH config provided too.

Usage

sh /path/to/ansible-control-run.sh playbook.yml inventory.ini or sh /path/to/ansible-control-test.sh playbook-test.yml inventory.ini

Restrictions

Some path variables and docker parameters are hardcoded, so the scripts are not ready as-is.

About

Docker Ansible container to launch and test playbooks on Windows

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published