ansible-nas/roles/dokuwiki/tasks/main.yml
2023-04-15 14:11:49 +01:00

41 lines
1.5 KiB
YAML

---
- name: Start Dokuwiki
block:
- name: Create DokuWiki Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ dokuwiki_data_directory }}/data"
- name: DokuWiki Docker Container
community.docker.docker_container:
name: "{{ dokuwiki_container_name }}"
image: linuxserver/dokuwiki:latest
pull: true
volumes:
- "{{ dokuwiki_data_directory }}:/config/dokuwiki/data:rw"
ports:
- "{{ dokuwiki_port }}:80"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ dokuwiki_user_id }}"
PGID: "{{ dokuwiki_group_id }}"
restart_policy: unless-stopped
memory: "{{ dokuwiki_memory }}"
labels:
traefik.enable: "{{ dokuwiki_available_externally | string }}"
traefik.http.routers.dokuwiki.rule: "Host(`{{ dokuwiki_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.dokuwiki.tls.certresolver: "letsencrypt"
traefik.http.routers.dokuwiki.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.dokuwiki.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.dokuwiki.loadbalancer.server.port: "80"
when: dokuwiki_enabled is true
- name: Stop Dokuwiki
block:
- name: Stop Dokuwiki
community.docker.docker_container:
name: "{{ dokuwiki_container_name }}"
state: absent
when: dokuwiki_enabled is false