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" path: "~/authentik/docker-compose.yml"
register: docker_compose_file register: docker_compose_file
- name: Remove authentik docker-compose. - name: Remove authentik docker-compose.
community.docker.docker_compose: community.docker.docker_compose:
project_src: ~/authentik/ project_src: ~/authentik/
build: false build: false
state: absent state: absent
when: docker_compose_file.stat.exists when: docker_compose_file.stat.exists
become: false become: false
- name: Remove the docker-compose file - name: Remove the docker-compose file
ansible.builtin.file: ansible.builtin.file:
path: "~/authentik/docker-compose.yml" path: "~/authentik/docker-compose.yml"
state: absent state: absent
when: docker_compose_file.stat.exists

View File

@ -3,20 +3,9 @@
hosts: all hosts: all
# gather_facts: false # gather_facts: false
pre_tasks: pre_tasks:
- name: Update apt cache. - name: "Include necessary variables"
apt: update_cache=yes cache_valid_time=600 ansible.builtin.include_vars:
when: ansible_os_family == 'Debian' file: "../../.env.yml"
- name: Install python requests
pip:
name:
- requests
- docker
- docker-compose
- name: Install docker
vars:
docker_service_manage: false
include_role:
name: geerlingguy.docker
roles: roles:
- role: laurivan.authentik - role: laurivan.authentik

View File

@ -6,6 +6,10 @@
no_log: "{{ molecule_no_log }}" no_log: "{{ molecule_no_log }}"
tasks: tasks:
# Developer must implement. # Developer must implement.
- name: Remove the docker image
community.docker.docker_container:
name: instance-authentik
state: absent
# Mandatory configuration for Molecule to function. # Mandatory configuration for Molecule to function.

View File

@ -10,7 +10,7 @@ dependency:
driver: driver:
name: docker name: docker
platforms: platforms:
- name: instance - name: instance-authentik
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""} command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes: volumes:

View File

@ -1,12 +1,30 @@
--- ---
- name: Setup the test machine - name: Setup the test machine
hosts: instance hosts: instance-authentik
tasks: tasks:
- name: Create docker.sock - name: Create docker.sock
raw: touch /var/run/docker.sock raw: touch /var/run/docker.sock
become: true become: true
changed_when: false changed_when: false
- name: Move docker.sock from tmp - name: Move docker.sock from tmp
raw: mount --move /tmp/docker_mounted.sock /var/run/docker.sock raw: mount --move /tmp/docker_mounted.sock /var/run/docker.sock
become: true become: true
changed_when: false 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 - name: Example assertion
ansible.builtin.assert: ansible.builtin.assert:
that: true that: true