blob: e6ac2d82e23c38e76adce7a701bf0a4f346b207a [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements; and to You under the Apache License, Version 2.0.
---
# This playbook cleans all docker containers
- hosts: all:!ansible
tasks:
- name: kill all docker containers
shell: "{{ item }}"
with_items:
- "RUNNING=$(docker ps -aq); if [ -n \"$RUNNING\" ]; then docker unpause $RUNNING > /dev/null; docker kill $RUNNING > /dev/null; docker rm -f -v $(docker ps -aq); fi"
- "DANGLING=$(docker images -q -f dangling=true); if [ -n \"$DANGLING\" ]; then docker rmi -f $DANGLING; fi"