ansible-role-plausible/tasks/main.yml

72 lines
1.6 KiB
YAML
Raw Permalink Normal View History

2022-09-19 14:59:05 +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 }}"
register: plausible_geoip_stat
- name: Set up directories
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
2022-09-22 12:50:10 +02:00
mode: "0750"
with_items:
- "{{ plausible_volume_config }}"
- "{{ plausible_volume_events }}"
- "~/plausible"
tags:
- configuration
2022-09-22 11:41:17 +02:00
become: true
- name: Set up the database directory.
ansible.builtin.file:
state: directory
path: "{{ item }}"
2022-09-22 12:50:10 +02:00
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"
- "env.db.conf"
tags:
- configuration
- name: Write plausible configuration (2)
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ plausible_volume_config }}/{{ item }}"
mode: '0644'
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