From ee157b53be7c176081aed96a74fe8ff09b208cb8 Mon Sep 17 00:00:00 2001 From: Bartek Grzybowski Date: Fri, 26 Apr 2019 13:26:45 +0200 Subject: Cleanup Rancher containers after Molecule converge Rancher role test do remove rancher/agent and rancher/server containers at 'cleanup' stage but Rancher Agent spawned containers are left orphaned. This patch adds tasks to remove them. This patch also adds custom ansible module for listing docker containers (as of ansible 2.7.10 no upstream module provides that feature, even new docker_container_info info module in ansible's devel branch doesn't have it) Change-Id: I6325dc81063b55b70136280273f8f6138c7a0375 Issue-ID: OOM-1811 Signed-off-by: Bartek Grzybowski --- ansible/roles/rancher/molecule/default/cleanup.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ansible/roles/rancher/molecule') diff --git a/ansible/roles/rancher/molecule/default/cleanup.yml b/ansible/roles/rancher/molecule/default/cleanup.yml index 13b48278..d4bf4495 100644 --- a/ansible/roles/rancher/molecule/default/cleanup.yml +++ b/ansible/roles/rancher/molecule/default/cleanup.yml @@ -7,8 +7,8 @@ container_list: - rancher-agent - rancher-server - # For some reason getting error "Device busy error" when trying to delete directory with root privileges and rancher-containers not anymore running. - # - role: cleanup-directories - # vars: - # directories_files_list_to_remove: - # - /var/lib/rancher/ + - role: cleanup-rancher + vars: + container_list_by_label: + - { 'label':'io.rancher.project.name', 'value':'healthcheck'} + - { 'label':'io.rancher.project.name', 'value':'kubernetes'} -- cgit 1.2.3-korg