0e0000276a
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.
10 lines
314 B
YAML
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
|