From 161d0b3b9f23052930845251044aad81844642fd Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Wed, 23 Sep 2020 11:05:26 -0300 Subject: [PATCH] Remove Vault public/private keys after testing. Public and private key files were created but not removed when testing the Vault module. This was fixed by adding a task to remove them to Vault's env_cleanup playbook. --- tests/vault/env_cleanup.yml | 8 ++++++++ tests/vault/env_setup.yml | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/vault/env_cleanup.yml b/tests/vault/env_cleanup.yml index 081a9d96..326c6202 100644 --- a/tests/vault/env_cleanup.yml +++ b/tests/vault/env_cleanup.yml @@ -62,3 +62,11 @@ file: path: "{{ ansible_env.HOME }}/in.txt" state: absent + + - name: Remove private/public key files. + shell: + cmd: rm -f private.pem public.pem + delegate_to: localhost + become: no + args: + warn: no # suppres warning for not using the `file` module. diff --git a/tests/vault/env_setup.yml b/tests/vault/env_setup.yml index a8437b86..2b4cca33 100644 --- a/tests/vault/env_setup.yml +++ b/tests/vault/env_setup.yml @@ -1,4 +1,7 @@ -# Tasks executed to ensure a sane environment to test IPA Vault module. +--- + # Tasks executed to ensure a sane environment to test IPA Vault module. + - name: Ensure environment is clean. + import_tasks: env_cleanup.yml - name: Create private key file. shell: @@ -12,9 +15,6 @@ delegate_to: localhost become: no - - name: Ensure environment is clean. - import_tasks: env_cleanup.yml - - name: Copy password file to target host. copy: src: "{{ playbook_dir }}/password.txt" -- GitLab