Better molecule support.

This commit is contained in:
Laur Ivan 2022-09-22 11:22:57 +02:00
parent 3707a3bdd9
commit 6f34af57d4
6 changed files with 31 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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:

View File

@ -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

View File

@ -8,3 +8,4 @@
- name: Example assertion
ansible.builtin.assert:
that: true