Goal: destroy dockers containers with ansible role arnaudblancher.docker_unprovisonning
This role is the companion of arnaudblancher.docker_provisionning witch take an ansible inventory and create one docker container for each listed hosts.
- docker-engine
Make sure your have a docker-engine running, test with (probably as root ...)
docker info
please see defaults/main.yml
None
Please see subdirectory ./demo/
cat demo/docker-unprovisionning.yml
- name: "remove docker containers and network"
hosts: localhost
gather_facts: no
roles:
- { role : arnaudblancher.docker_unprovisionning,
docker_unprovisionning_net: "ansible_myplateform" }
cat inventory/docker/000_hosts
[mysql]
dock-mysql
[apache]
dock-apache
[all:vars]
ansible_connection=docker
call :
ansible-playbook -i ./inventory/docker/ docker-unprovisionning.yml
Of course, you could use the same inventory for create and destroy yours containers.
GPLv3
Arnaud Blancher
https://github.com/arnaudblancher/ansible-role-docker_unprovisionning