diff --git a/molecule/default/cleanup.yml b/molecule/default/cleanup.yml index c6ca727..d97fd4b 100644 --- a/molecule/default/cleanup.yml +++ b/molecule/default/cleanup.yml @@ -8,13 +8,16 @@ 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 + when: docker_compose_file.stat.exists diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 1f656ca..abf3a86 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,20 +3,9 @@ hosts: all # gather_facts: false pre_tasks: - - name: Update apt cache. - apt: update_cache=yes cache_valid_time=600 - when: ansible_os_family == 'Debian' - - name: Install python requests - pip: - name: - - requests - - docker - - docker-compose - - name: Install docker - vars: - docker_service_manage: false - include_role: - name: geerlingguy.docker + - name: "Include necessary variables" + ansible.builtin.include_vars: + file: "../../.env.yml" roles: - role: laurivan.authentik diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml index dd6e220..9e9c48c 100644 --- a/molecule/default/destroy.yml +++ b/molecule/default/destroy.yml @@ -6,6 +6,10 @@ no_log: "{{ molecule_no_log }}" tasks: # Developer must implement. + - name: Remove the docker image + community.docker.docker_container: + name: instance-authentik + state: absent # Mandatory configuration for Molecule to function. diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index e3697e9..e1c4919 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -10,7 +10,7 @@ dependency: driver: name: docker platforms: - - name: instance + - name: instance-authentik image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 07ac131..66e40b1 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -1,12 +1,30 @@ --- - name: Setup the test machine - hosts: instance + hosts: instance-authentik tasks: - name: Create docker.sock raw: touch /var/run/docker.sock become: true changed_when: false + - name: Move docker.sock from tmp raw: mount --move /tmp/docker_mounted.sock /var/run/docker.sock become: true changed_when: false + + - name: Update apt cache. + apt: update_cache=yes cache_valid_time=600 + when: ansible_os_family == 'Debian' + + - name: Install python requests + pip: + name: + - requests + - docker + - docker-compose + + - name: Install docker + vars: + docker_service_manage: false + include_role: + name: geerlingguy.docker diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index e707420..b00a8ab 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -8,3 +8,4 @@ - name: Example assertion ansible.builtin.assert: that: true + \ No newline at end of file