--- # Check if geoip volume exists - name: Check if geoip volume exists ansible.builtin.stat: 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 }}" mode: "0750" with_items: - "{{ plausible_volume_config }}" - "{{ plausible_volume_events }}" - "~/plausible" tags: - configuration become: true - 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" - "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