From 5932c1bf58a76aae0c1bdee8ba9ae8b4fab1b985 Mon Sep 17 00:00:00 2001 From: Laur Ivan Date: Sun, 18 Sep 2022 13:11:29 +0200 Subject: [PATCH] Better molecule. --- molecule/default/cleanup.yml | 19 +++++++++++++++++++ molecule/default/prepare.yml | 2 +- tasks/main.yml | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 molecule/default/cleanup.yml diff --git a/molecule/default/cleanup.yml b/molecule/default/cleanup.yml new file mode 100644 index 0000000..dedb0c7 --- /dev/null +++ b/molecule/default/cleanup.yml @@ -0,0 +1,19 @@ +--- +- name: Clean up + hosts: all + tasks: + - name: Check if the docker-compose file exists. + ansible.builtin.stat: + path: "~/authentik/docker-compose.yml" + register: docker_compose_file + - name: Remove authentik docker-compose. + community.docker.docker_compose: + project_src: ~/authentik/ + build: false + state: absent + when: docker_compose_file.stat.exists + become: false + - name: Remove the docker-compose file + ansible.builtin.file: + path: "~/authentik/docker-compose.yml" + state: absent diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 3394f1d..a81b466 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -1,6 +1,6 @@ --- - name: Setup the test machine - hosts: instance-authentik + hosts: all tasks: - name: create docker.sock raw: touch /var/run/docker.sock diff --git a/tasks/main.yml b/tasks/main.yml index ff8b0f3..a0e79cf 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,7 +2,7 @@ # tasks file for authentik - name: Set up directories - file: + ansible.builtin.file: state: directory path: "{{ item }}" mode: 0755 @@ -19,7 +19,7 @@ become: false - name: Set up the database directory. - file: + ansible.builtin.file: state: directory path: "{{ item }}" mode: 0755