Images for running ansible from within a docker container.
1.3K
This a docker image for running ansible. It was made as a convenient way to run ansible from within windows, but it can be used on any docker plataform as well.
Instead of running a service inside a detached container, you run /usr/bin/ansible or /usr/bin/ansible-playbook inside an interactive mode container, mapping your current windows directory (containing your ansible code) inside the container.
Docker, and some aliases shown bellow.
On Windows, I have only using both Docker Toolbox and Docker for Windows (with linux containers).
These allow you to use "ansible" and "ansible-playbook" nearly transparently.
alias ansible-playbook='docker run -it --rm -w /code -v \`pwd\`:/code dgmorales/ansible'
alias ansible='docker run -it --rm -w /code -v \`pwd\`:/code --entrypoint /usr/bin/ansible dgmorales/ansible'
You can place these lines inside ~/.bash_profile (create this file if necessary), so they will always be available.
Docker for Windows does not use bash shell as toolbox does, so we instead use powershell functions as aliases:
function ansible {
docker run -it --rm -w /code -v ${pwd}:/code --entrypoint /usr/bin/ansible dgmorales/ansible $args
}
function ansible-playbook {
docker run -it --rm -w /code -v ${pwd}:/code dgmorales/ansible $args
}
Place these at $Home\Documents\WindowsPowerShell\Profile.ps1 and they will be loaded automatically on the powershell terminal.
Content type
Image
Digest
Size
149.7 MB
Last updated
almost 10 years ago
docker pull dgmorales/ansible