solar-resources/examples/resources/simple/containers/ensure.yml
Evgeniy L 0e0000276a Implement ensure mechanism for containers
Added workaround to stop containers which should
not be on the node, accouding to a file with list
of services which is filled in by ansible's tasks.

It allows to implement scale-down and resource
migration.
2015-04-23 16:07:31 +03:00

10 lines
314 B
YAML

- hosts: [service/containers]
sudo: yes
tasks:
- shell: docker ps -a | egrep -v "CONTAINER ID|$(cat /var/lib/solar/containers_list | tr '\n' '|' | sed 's/|$//')" | egrep 'solar\.' | awk '{print $1}'
register: containers
- shell: docker rm -f {{item}}
with_items: containers.stdout_lines