ansible-role-plausible/tasks/main.yml

71 lines
1.5 KiB
YAML
Raw Normal View History

2022-09-19 14:59:05 +02:00
---
# tasks file for plausible
# 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 }}"
register: plausible_geoip_stat
- name: Set up directories
ansible.builtin.file:
state: directory
path: "{{ item }}"
mode: 0755
with_items:
- "{{ plausible_volume_config }}"
- "{{ plausible_volume_events }}"
- "~/plausible"
tags:
- configuration
become: false
- name: Set up the database directory.
ansible.builtin.file:
state: directory
path: "{{ item }}"
mode: 0755
owner: 70
with_items:
- "{{ plausible_volume_db }}"
tags:
- configuration
become: true
- name: Write plausible configuration (1)
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "{{ plausible_volume_config }}/{{ item }}"
mode: '0640'
loop:
- "env.plausible.conf"
- "env.mail.conf"
tags:
- configuration
- name: Write plausible configuration (2)
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ plausible_volume_config }}/{{ item }}"
mode: '0640'
loop:
- "clickhouse-config.xml"
- "clickhouse-user-config.xml"
tags:
- configuration
- name: Copy plausible docker-compose template.
ansible.builtin.template:
src: templates/docker-compose.yml.j2
dest: ~/plausible/docker-compose.yml
mode: '0640'
become: false
notify: Restart plausible
- name: Ensure plausible is running.
community.docker.docker_compose:
project_src: ~/plausible/
build: false
become: false