Sign inSign up

pierrecdn/ansible

By pierrecdn

•Updated about 11 years ago

Run Ansible from inside Docker

Image
0

379

pierrecdn/ansible repository overview

⁠docker-ansible

Run Ansible⁠ from inside a container (learn how to use Ansible⁠)

Ansible logo

⁠How to use this Docker image

  • Simple use-case :
$ docker run -ti --rm -v <your_rsa_key>:/root/.ssh/id_rsa:ro -v <your_playbooks_root>:/etc/ansible:ro pierrecdn/ansible ansible-playbook -i <inventory_file> <playbook_file>

PLAY [your-hostgroup] *********************************************************

GATHERING FACTS *************************************************************** 
ok: [host-1]
ok: [host-2]
ok: [host-3]

TASK: [task-1 | My task to rule the world] ************************************ 
(...)

⁠Advices and remarks

  • Take care of integrity of your files: use :ro when mouting volumes, no reason for ansible to write anything.

  • Ansible has no real context over 2 subsequent executions, so it can be reinstantiated each time. That's why containerize it and passing --rm it's not a problem.

  • If you plan to use Docker on the local instance, you will probably face a problem. Look at jpetazzo/dind⁠ first.

  • Remark : this image is shipped with pip and docker-py⁠ (See here⁠ for the features it enable)

Tag summary

Content type

Image

Digest

sha256:15e4097f0…

Size

168.5 MB

Last updated

about 11 years ago

docker pull pierrecdn/ansible