Sure, the general pattern I follow is thus:
1. I use a base docker image that already has ansible installed.
2. In your Dockerfile, use the COPY command to copy your ansible files
(playbook yaml, files, etc.) into the container. Something like:
COPY ansible/ /tmp/ansible/
3. After the copy, in your Dockerfile, run ansible-playbook on the
files you copied into the container in the previous step:
RUN ansible-playbook /tmp/ansible/foo.yml -i /tmp/ansible/hosts
In this case, /tmp/ansible/hosts just contains:
[local]
127.0.0.1
And in the playbook, I specify:
- hosts: local
connection: local
4. After the playbook completes, remove the ansible files you copied
in during step 2.
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
ansible-proje...@googlegroups.com.
> To post to this group, send email to
ansible...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/eb3bbdb6-f34e-48c8-af70-2f34819f0a52%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.