Add molecule files.

Add default variables.
Add empty templates.
This commit is contained in:
Laur Ivan 2022-09-19 23:13:01 +02:00
parent d6427f4c6b
commit 11a819ea2f
10 changed files with 137 additions and 87 deletions

View File

@ -1,2 +1,35 @@
---
# defaults file for plausible
# Docker user
plausible_uid: docker
plausible_gid: docker
# Email
plausible_smtp_host:
plausible_smtp_port: 587
plausible_smtp_username:
plausible_smtp_password:
# Plausible parameters
plausible_port: 8000
plausible_admin_user_email: change-me
plausible_admin_user_name: change-me
plausible_admin_user_pwd: change-me
plausible_base_url: change-me
plausible_secret_key_base: change-me
# SMTP
plausible_smtp_email: "changeme@example.com"
# Database
plausible_clickhouse_version: "21.3.2.5"
plausible_version: "latest"
plausible_pg_password: "change_me"
# Volumes
plausible_base: "/mnt/plausible"
plausible_config: "{{ plausible_base }}/config"
plausible_db_data: "{{ plausible_base }}/db_data"
plausible_event_data: "{{ plausible_base }}/event_data"
plausible_geoip_database: "{{ plausible_base }}/geoip_data"

View File

@ -1,53 +1,34 @@
galaxy_info:
author: your name
author: Laur Ivan
namespace: laurivan
description: your role description
company: your company (optional)
role_name: plausible
description: Plausible installation via docker
license: MIT
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
min_ansible_version: "2.4"
min_ansible_container_version: "2.4"
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
platforms:
- name: Debian
versions:
- buster
- bullseye
- name: Ubuntu
versions:
- bionic
- focal
- jammy
- name: Alpine
version:
- all
- name: ArchLinux
versions:
- all
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
galaxy_tags:
- docker
- authentik
- sso
- authentication
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,20 @@
---
- name: Clean up
hosts: all
gather_facts: true
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

View File

@ -1,8 +1,23 @@
---
- name: Converge
hosts: all
gather_facts: false
tasks:
- name: "Include laurivan.plausible"
ansible.builtin.include_role:
name: "laurivan.plausible"
# 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
roles:
- role: laurivan.plausible

View File

@ -1,35 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
# TODO: Developer must implement and populate 'server' variable
- when: server.changed | default(false) | bool
block:
- name: Populate instance config dict
ansible.builtin.set_fact:
instance_conf_dict: {
'instance': "{{ }}",
'address': "{{ }}",
'user': "{{ }}",
'port': "{{ }}",
'identity_file': "{{ }}", }
with_items: "{{ server.results }}"
register: instance_config_dict
- name: Convert instance config dict to a list
ansible.builtin.set_fact:
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
- name: Dump instance config
ansible.builtin.copy:
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
mode: 0600

View File

@ -1,11 +1,30 @@
---
role_name_check: 1
dependency:
name: galaxy
options:
ignore-certs: true
ignore-errors: true
role-file: molecule/requirements.yml
requirements-file: molecule/requirements.yml
driver:
name: delegated
name: docker
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /var/run/docker.sock:/tmp/docker_mounted.sock
privileged: true
pre_build_image: true
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .

View File

@ -0,0 +1,12 @@
---
- name: Setup the test machine
hosts: instance
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

View File

@ -0,0 +1,5 @@
---
roles:
- geerlingguy.docker
collections:
- community.docker

View File

View File