Clean application role mocked artifacts directories 32/89332/1
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Wed, 5 Jun 2019 08:10:55 +0000 (10:10 +0200)
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>
Wed, 5 Jun 2019 08:10:55 +0000 (10:10 +0200)
Directories created by Molecule tests were left in
files tree and not cleaned up. This patch adds a task
to shred them after test invocation.

Change-Id: If745cfc45de2f73db5be1696a16a185ff2a625bf
Issue-ID: OOM-1910
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
ansible/roles/application/.gitignore [deleted file]
ansible/roles/application/molecule/custom_role/molecule.yml
ansible/roles/application/molecule/default/cleanup.yml [new file with mode: 0644]
ansible/test/roles/cleanup-application/tasks/main.yml [new file with mode: 0644]

diff --git a/ansible/roles/application/.gitignore b/ansible/roles/application/.gitignore
deleted file mode 100644 (file)
index 155cbb2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-application/
index 5356b19..f9b29d9 100644 (file)
@@ -34,6 +34,7 @@ provisioner:
   playbooks:
     prepare: ../default/prepare.yml
     converge: ../default/playbook.yml
+    cleanup: ../default/cleanup.yml
 scenario:
   name: custom_role
   test_sequence:
diff --git a/ansible/roles/application/molecule/default/cleanup.yml b/ansible/roles/application/molecule/default/cleanup.yml
new file mode 100644 (file)
index 0000000..996acaf
--- /dev/null
@@ -0,0 +1,6 @@
+---
+- name: Cleanup infra
+  hosts: all
+  ignore_unreachable: true
+  roles:
+    - cleanup-application
diff --git a/ansible/test/roles/cleanup-application/tasks/main.yml b/ansible/test/roles/cleanup-application/tasks/main.yml
new file mode 100644 (file)
index 0000000..cbb8d52
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- name: Clean application role mocked artifacts directories
+  file:
+    path: "{{ item }}"
+    state: absent
+  delegate_to: localhost
+  loop:
+    - certs
+    - application