Welcome to dockerfile-ansible
With this docker image you can create a temporary container to run ansible(-playbook), after ansible is finished the container will be removed automatically.
This image is tested with boot2docker on OSX and virtualbox with Centos
Version of ansible at this moment is 1.9.2
More information about how to install boot2docker or docker on centos
- boot2docker: http://boot2docker.io
- Centos: https://docs.docker.com/installation/centos/
This github repository is integrated with docker hub, the build is automated and the image is available inside the docker public registry.
- Docker Automated Build: https://registry.hub.docker.com/u/nickvth/dockerfile-ansible/
docker search dockerfile-ansible
Usage
- You can pull the image from the public docker registry
docker pull nickvth/dockerfile-ansible
- If you want to make changes and build your own image
cd /tmp/
git clone https://github.com/nickvth/dockerfile-ansible.git
cd dockerfile-ansible
docker build --force-rm=true --no-cache=true -t nickvth/dockerfile-ansible .
- Create dir to put your ansible playbook and inventory file
mkdir -p /mnt/ansible
- Create aliases on your linux based system and do some tests with ansible command
alias ansible='docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /usr/bin/ansible'
ansible --version
ansible --help
ansible -i hosts testansible -k -m setup
alias ansible-playbook='docker run -it --rm=true -v /mnt/ansible:/mnt nickvth/dockerfile-ansible /usr/bin/ansible-playbook'
ansible-playbook --version
ansible-playbook --help
Set your alias in .bash_profile, so when you login the alias will be available
- OSX: http://www.maclife.com/article/columns/terminal_101_creating_aliases_commands
- Centos: http://shapeshed.com/using_aliases_in_the_linux_shell/
- You can also make changes on the ansible.cfg and rebuild image if you want.