Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a3adb0ce2 | |||
| d970ae0683 | |||
| 5829f66490 |
@@ -29,3 +29,6 @@ plausible_volume_config: "{{ plausible_volume_base }}/config"
|
|||||||
plausible_volume_db: "{{ plausible_volume_base }}/db_data"
|
plausible_volume_db: "{{ plausible_volume_base }}/db_data"
|
||||||
plausible_volume_events: "{{ plausible_volume_base }}/event_data"
|
plausible_volume_events: "{{ plausible_volume_base }}/event_data"
|
||||||
plausible_volume_geoip: "{{ plausible_volume_base }}/geoip_data"
|
plausible_volume_geoip: "{{ plausible_volume_base }}/geoip_data"
|
||||||
|
|
||||||
|
# GeoIP
|
||||||
|
plausible_geoip_db: "GeoLite2-Country.mmdb"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# Developer must implement.
|
# Developer must implement.
|
||||||
- name: Remove the docker image
|
- name: Remove the docker image
|
||||||
community.docker.docker_container:
|
community.docker.docker_container:
|
||||||
name: instance
|
name: instance-plausible
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# Mandatory configuration for Molecule to function.
|
# Mandatory configuration for Molecule to function.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ dependency:
|
|||||||
driver:
|
driver:
|
||||||
name: docker
|
name: docker
|
||||||
platforms:
|
platforms:
|
||||||
- name: instance
|
- name: instance-plausible
|
||||||
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:
|
||||||
|
|||||||
@@ -1,15 +1,24 @@
|
|||||||
---
|
---
|
||||||
- name: Setup the test machine
|
- name: Setup the test machine
|
||||||
hosts: instance
|
hosts: instance-plausible
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Check if /var/run/docker.sock already exists
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "/var/run/docker.sock"
|
||||||
|
register: docker_sock_stat
|
||||||
|
|
||||||
- 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
|
||||||
|
when: not docker_sock_stat.stat.exists
|
||||||
|
|
||||||
- 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
|
||||||
|
when: not docker_sock_stat.stat.exists
|
||||||
|
|
||||||
- name: Update apt cache.
|
- name: Update apt cache.
|
||||||
apt: update_cache=yes cache_valid_time=600
|
apt: update_cache=yes cache_valid_time=600
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|||||||
@@ -4,21 +4,22 @@
|
|||||||
# Check if geoip volume exists
|
# Check if geoip volume exists
|
||||||
- name: Check if geoip volume exists
|
- name: Check if geoip volume exists
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ plausible_volume_geoip }}/GeoLite2-Country.mmdb"
|
path: "{{ plausible_volume_geoip }}/{{ plausible_geoip_db }}"
|
||||||
register: plausible_geoip_stat
|
register: plausible_geoip_stat
|
||||||
|
|
||||||
- name: Set up directories
|
- name: Set up directories
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: directory
|
state: directory
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
mode: 0755
|
owner: "{{ ansible_user_id }}"
|
||||||
|
mode: 0750
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ plausible_volume_config }}"
|
- "{{ plausible_volume_config }}"
|
||||||
- "{{ plausible_volume_events }}"
|
- "{{ plausible_volume_events }}"
|
||||||
- "~/plausible"
|
- "~/plausible"
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
become: false
|
become: true
|
||||||
|
|
||||||
- name: Set up the database directory.
|
- name: Set up the database directory.
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ services:
|
|||||||
- {{ plausible_volume_config }}/env.plausible.conf
|
- {{ plausible_volume_config }}/env.plausible.conf
|
||||||
{% if plausible_geoip_stat.stat.exists %}
|
{% if plausible_geoip_stat.stat.exists %}
|
||||||
volumes:
|
volumes:
|
||||||
- {{ plausible_volume_geoip }}/GeoLite2-Country.mmdb:/geoip:ro
|
- {{ plausible_volume_geoip }}/{{ plausible_geoip_db }}:/geoip:ro
|
||||||
{% else %}
|
{% else %}
|
||||||
# No GeoIP data volume
|
# No GeoIP data volume
|
||||||
{% endif%}
|
{% endif%}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ BASE_URL={{ plausible_base_url }}
|
|||||||
SECRET_KEY_BASE={{ plausible_secret_key_base }}
|
SECRET_KEY_BASE={{ plausible_secret_key_base }}
|
||||||
|
|
||||||
{% if plausible_geoip_stat.stat.exists %}
|
{% if plausible_geoip_stat.stat.exists %}
|
||||||
GEOLITE2_COUNTRY_DB={{ plausible_volume_geoip }}/GeoLite2-Country.mmdb
|
GEOLITE2_COUNTRY_DB={{ plausible_volume_geoip }}/{{ plausible_geoip_db }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# DB and events
|
# DB and events
|
||||||
|
|||||||
Reference in New Issue
Block a user