2022-09-19 14:59:05 +02:00
|
|
|
---
|
|
|
|
# tasks file for plausible
|
2022-09-22 07:50:00 +02:00
|
|
|
|
2022-09-22 09:43:03 +02:00
|
|
|
# Check if geoip volume exists
|
|
|
|
- name: Check if geoip volume exists
|
|
|
|
ansible.builtin.stat:
|
2022-09-22 11:34:33 +02:00
|
|
|
path: "{{ plausible_volume_geoip }}/{{ plausible_geoip_db }}"
|
2022-09-22 09:43:03 +02:00
|
|
|
register: plausible_geoip_stat
|
|
|
|
|
2022-09-22 07:50:00 +02:00
|
|
|
- name: Set up directories
|
|
|
|
ansible.builtin.file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ item }}"
|
2022-09-22 12:41:15 +02:00
|
|
|
owner: "{{ ansible_effective_user_id }}"
|
|
|
|
group: "{{ ansible_effective_group_id }}"
|
2022-09-22 12:50:10 +02:00
|
|
|
mode: "0750"
|
2022-09-22 07:50:00 +02:00
|
|
|
with_items:
|
|
|
|
- "{{ plausible_volume_config }}"
|
2022-09-22 09:43:03 +02:00
|
|
|
- "{{ plausible_volume_events }}"
|
2022-09-22 07:50:00 +02:00
|
|
|
- "~/plausible"
|
|
|
|
tags:
|
|
|
|
- configuration
|
2022-09-22 11:41:17 +02:00
|
|
|
become: true
|
2022-09-22 07:50:00 +02:00
|
|
|
|
|
|
|
- name: Set up the database directory.
|
|
|
|
ansible.builtin.file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ item }}"
|
2022-09-22 12:50:10 +02:00
|
|
|
mode: "0755"
|
2022-09-22 07:50:00 +02:00
|
|
|
owner: 70
|
|
|
|
with_items:
|
|
|
|
- "{{ plausible_volume_db }}"
|
|
|
|
tags:
|
|
|
|
- configuration
|
2022-09-22 09:43:03 +02:00
|
|
|
become: true
|
2022-09-22 07:50:00 +02:00
|
|
|
|
2022-09-22 09:43:03 +02:00
|
|
|
- name: Write plausible configuration (1)
|
2022-09-22 07:50:00 +02:00
|
|
|
ansible.builtin.template:
|
2022-09-22 09:43:03 +02:00
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "{{ plausible_volume_config }}/{{ item }}"
|
2022-09-22 07:50:00 +02:00
|
|
|
mode: '0640'
|
2022-09-22 09:43:03 +02:00
|
|
|
loop:
|
|
|
|
- "env.plausible.conf"
|
|
|
|
- "env.mail.conf"
|
2022-09-23 12:50:15 +02:00
|
|
|
- "env.db.conf"
|
2022-09-22 09:43:03 +02:00
|
|
|
tags:
|
|
|
|
- configuration
|
|
|
|
|
|
|
|
- name: Write plausible configuration (2)
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ plausible_volume_config }}/{{ item }}"
|
2022-09-22 12:41:15 +02:00
|
|
|
mode: '0644'
|
2022-09-22 09:43:03 +02:00
|
|
|
loop:
|
|
|
|
- "clickhouse-config.xml"
|
|
|
|
- "clickhouse-user-config.xml"
|
|
|
|
tags:
|
|
|
|
- configuration
|
2022-09-22 07:50:00 +02:00
|
|
|
|
2022-09-22 09:43:03 +02:00
|
|
|
- name: Copy plausible docker-compose template.
|
2022-09-22 07:50:00 +02:00
|
|
|
ansible.builtin.template:
|
2022-09-22 09:43:03 +02:00
|
|
|
src: templates/docker-compose.yml.j2
|
|
|
|
dest: ~/plausible/docker-compose.yml
|
2022-09-22 07:50:00 +02:00
|
|
|
mode: '0640'
|
|
|
|
become: false
|
|
|
|
notify: Restart plausible
|
|
|
|
|
|
|
|
- name: Ensure plausible is running.
|
|
|
|
community.docker.docker_compose:
|
|
|
|
project_src: ~/plausible/
|
|
|
|
build: false
|
|
|
|
become: false
|
|
|
|
|