ansible testing with docker connection plugin
Python Makefile
Latest commit bdd9581 Jul 8, 2016 @shirou add which to inspect.
Permalink
Failed to load latest commit information.
inventory_docker add gitlab.yml Jul 8, 2016
roles initial. Jul 7, 2016
.gitignore initial. Jul 7, 2016
.gitlab-ci.yml add gitlab.yml Jul 8, 2016
.travis.yml add which to inspect. Jul 8, 2016
Makefile initial. Jul 7, 2016
README.rst initial. Jul 7, 2016
circle.yml update DOCKER_HOST Jul 8, 2016
requirements.yml initial. Jul 7, 2016
test.yml add gitlab.yml Jul 8, 2016
vars.yml initial. Jul 7, 2016
web.yml initial. Jul 7, 2016

README.rst

Ansible docker testing on CircleCI

What's this

This is an sample repository to test ansible inside the docker container on the CircleCI. This example user docker connection plugin, so you does not need to install sshd container inside.

inventory_docker is an inventory directory to load both static and dynamic inventory.

Explaining circle.yml

- docker run -d --name web ubuntu:16.04 /bin/sleep 3600

This line means start ubuntu:16.04 image with web name. Ansible docker dynamic inventory returns group with this name.

Here is a part of JSON which dynamic inventory returnes.

"web": [
  "web"
],
"image_ubuntu:16.04": [
  "web"
],
"33220114d5bed36e03dfac72d52ae115a2da12f3e08b995325182398aae2a95a": [
  "web"
],
"33220114d5bed": [
  "web"
],
"running": [
  "web"
],
"docker_hosts": [
  "unix://var/run/docker.sock"
],
"unix://var/run/docker.sock": [
  "web"
],

The point is, set container name to your actual group. web in this case. It makes your playbook stable.

- ansible-playbook -i inventory_docker web.yml.

And run ansible-playbook command.