commit d14bebbf1aaa602e881a60d1fee20560c8279c9b Author: Olivier Navas Date: Sun Feb 18 19:16:00 2024 +0100 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..ca46b28 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Role : docker_dokuwiki + + +## Services fournis + +Installation de dokuwiki sur un serveur docker_host + + +## Variables + +Fournir les variables suivantes. Par exemple : + +```yaml +docker_dokuwiki_fqdn: dokuwiki.example.com +docker_dokuwiki_version: lscr.io/linuxserver/dokuwiki:latest +docker_dokuwiki_data_dir: /data1 +docker_dokuwiki_service_id: dokuwiki_example_com +``` + +| Option | Valeur par défaut | Description | +|----------------------------------|-------------------|-------------------------------------------------------------------------------------------| +| docker_dokuwiki_fqdn | | Le nom de domaine pour lequel le service dokuwiki répond | +| docker_dokuwiki_version | | La version de l'image docker dokuwiki | +| docker_dokuwiki_data_dir | | L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service | +| docker_dokuwiki_service_id | | Le nom de service souhaité : conditionne le nommage des volumes et le routage par traefik | + + +## Premier démarrage dans dokuwiki + +Se connecter à dokuwiki à l'url /install.php pour configurer l'utilisateur admin et les premiers paramètres. diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..203f59c --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,5 @@ +- name: docker-compose-up + shell: | + docker compose up -d + args: + chdir: /opt/{{ docker_dokuwiki_service_id }}/ diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..681fb84 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,8 @@ +galaxy_info: + author: Olivier Navas + description: Modèle d'installation Libretic pour dokuwiki + license: GPL-3.0-only + min_ansible_version: 2.9 + galaxy_tags: [] + +dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..a9081cc --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,18 @@ +- name: docker directory + file: + path: /opt/{{ docker_dokuwiki_service_id }}/ + state: directory + +- name: docker data directory + file: + path: "{{ docker_dokuwiki_data_dir }}/{{ docker_dokuwiki_service_id }}/" + state: directory + register: _datadir + +- name: prepare docker-compose.yml and files + template: + src: "{{ item }}" + dest: /opt/{{ docker_dokuwiki_service_id }}/ + with_items: + - docker-compose.yml + notify: docker-compose-up diff --git a/templates/docker-compose.yml b/templates/docker-compose.yml new file mode 100644 index 0000000..5d31e12 --- /dev/null +++ b/templates/docker-compose.yml @@ -0,0 +1,26 @@ +# {{ ansible_managed }} + +version: '3.1' + +services: + dokuwiki: + image: {{ docker_dokuwiki_image_version }} + restart: always + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/Paris + volumes: + - {{ docker_dokuwiki_data_dir }}/{{ docker_dokuwiki_service_id }}/config:/config + labels: + traefik.enable: "true" + traefik.docker.network: "traefik" + traefik.http.routers.{{ docker_dokuwiki_service_id }}.entrypoints: "web" + traefik.http.routers.{{ docker_dokuwiki_service_id }}.rule: "Host(`{{ docker_dokuwiki_fqdn }}`)" + traefik.http.services.{{ docker_dokuwiki_service_id }}.loadbalancer.server.port: "80" + networks: + - traefik + +networks: + traefik: + external: true