Add molecule files.
Add default variables. Add empty templates.
This commit is contained in:
parent
d6427f4c6b
commit
11a819ea2f
@ -1,2 +1,35 @@
|
|||||||
---
|
---
|
||||||
# defaults file for plausible
|
# 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"
|
@ -1,53 +1,34 @@
|
|||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: your name
|
author: Laur Ivan
|
||||||
namespace: laurivan
|
namespace: laurivan
|
||||||
description: your role description
|
role_name: plausible
|
||||||
company: your company (optional)
|
description: Plausible installation via docker
|
||||||
|
license: MIT
|
||||||
|
|
||||||
# If the issue tracker for your role is not on github, uncomment the
|
min_ansible_version: "2.4"
|
||||||
# next line and provide a value
|
min_ansible_container_version: "2.4"
|
||||||
# issue_tracker_url: http://example.com/issue/tracker
|
|
||||||
|
|
||||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
platforms:
|
||||||
# - BSD-3-Clause (default)
|
- name: Debian
|
||||||
# - MIT
|
versions:
|
||||||
# - GPL-2.0-or-later
|
- buster
|
||||||
# - GPL-3.0-only
|
- bullseye
|
||||||
# - Apache-2.0
|
- name: Ubuntu
|
||||||
# - CC-BY-4.0
|
versions:
|
||||||
license: license (GPL-2.0-or-later, MIT, etc)
|
- bionic
|
||||||
|
- focal
|
||||||
|
- jammy
|
||||||
|
- name: Alpine
|
||||||
|
version:
|
||||||
|
- all
|
||||||
|
- name: ArchLinux
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
|
||||||
min_ansible_version: 2.1
|
galaxy_tags:
|
||||||
|
- docker
|
||||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
- authentik
|
||||||
# min_ansible_container_version:
|
- sso
|
||||||
|
- authentication
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
dependencies: []
|
dependencies: []
|
||||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
|
||||||
# if you add dependencies to this list.
|
|
||||||
|
20
molecule/default/cleanup.yml
Normal file
20
molecule/default/cleanup.yml
Normal 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
|
@ -1,8 +1,23 @@
|
|||||||
---
|
---
|
||||||
- name: Converge
|
- name: Converge
|
||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: false
|
# gather_facts: false
|
||||||
tasks:
|
pre_tasks:
|
||||||
- name: "Include laurivan.plausible"
|
- name: Update apt cache.
|
||||||
ansible.builtin.include_role:
|
apt: update_cache=yes cache_valid_time=600
|
||||||
name: "laurivan.plausible"
|
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
|
||||||
|
|
||||||
|
@ -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
|
|
@ -1,11 +1,30 @@
|
|||||||
---
|
---
|
||||||
|
role_name_check: 1
|
||||||
dependency:
|
dependency:
|
||||||
name: galaxy
|
name: galaxy
|
||||||
|
options:
|
||||||
|
ignore-certs: true
|
||||||
|
ignore-errors: true
|
||||||
|
role-file: molecule/requirements.yml
|
||||||
|
requirements-file: molecule/requirements.yml
|
||||||
driver:
|
driver:
|
||||||
name: delegated
|
name: docker
|
||||||
platforms:
|
platforms:
|
||||||
- name: instance
|
- 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:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
playbooks:
|
||||||
|
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
||||||
verifier:
|
verifier:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
lint: |
|
||||||
|
set -e
|
||||||
|
yamllint .
|
||||||
|
ansible-lint .
|
12
molecule/default/prepare.yml
Normal file
12
molecule/default/prepare.yml
Normal 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
|
5
molecule/requirements.yml
Normal file
5
molecule/requirements.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
roles:
|
||||||
|
- geerlingguy.docker
|
||||||
|
collections:
|
||||||
|
- community.docker
|
0
templates/docker-compose.yml.j2
Normal file
0
templates/docker-compose.yml.j2
Normal file
0
templates/env.plausible.conf.j2
Normal file
0
templates/env.plausible.conf.j2
Normal file
Loading…
Reference in New Issue
Block a user