This is image contains git and ansible
$ docker run --rm -it \
-v $HOME/.ssh:/root/.ssh \
-v $HOME/playbooks:/playbooks \
-v $HOME/playbooks/hosts:/etc/ansible/hosts \
jefferyb/ansible:xenial \
ansible -u $USER remote_server -m ping
$ docker run --rm -it \
-v $HOME/.ssh:/root/.ssh \
-v $HOME/playbooks:/playbooks \
-v $HOME/playbooks/hosts:/etc/ansible/hosts \
jefferyb/ansible:xenial bash
$ ansible -u username remote_server -m ping
and you can start using ansible as normal
Assuming your playbooks are located at $HOME/playbooks and your hosts file is located at $HOME/playbooks/hosts, then you can do:
$ alias ansible="docker run --rm -it -v $HOME/.ssh:/root/.ssh -v $HOME/playbooks:/playbooks -v $HOME/playbooks/hosts:/etc/ansible/hosts jefferyb/ansible:xenial ansible -u $USER"
$ ansible remote_server -m ping
Content type
Image
Digest
Size
114.9 MB
Last updated
over 7 years ago
docker pull jefferyb/ansible