From 420f3acf8073c14527c8e29e0977c97b7048210e Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Fri, 2 Aug 2019 16:15:47 +0100 Subject: [PATCH 1/9] Preliminary Dokuwiki version up and running on nginx - incomplete yet --- defaults/main.yml | 27 +++++++--- handlers/main.yml | 10 ++++ tasks/main.yml | 30 +++++++++++ tasks/setup-Debian.yml | 91 ++++++++++++++++++++++++++------ templates/nginx.dokuwiki.conf.j2 | 63 ++++++++++++++++++++++ templates/php-fpm.www.conf.j2 | 17 ++++++ vars/Debian.yml | 26 +++++++++ vars/main.yml | 3 ++ 8 files changed, 244 insertions(+), 23 deletions(-) create mode 100644 templates/nginx.dokuwiki.conf.j2 create mode 100644 templates/php-fpm.www.conf.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 5919a2a..52d2c46 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,9 +1,27 @@ --- # defaults file for PeterMosmans.dokuwiki +# webserver +dokuwiki_webserver: "nginx" # [nginx, apache] +dokuwiki_provision: false +dokuwiki_webserver_nginx_conf: "/etc/nginx/" # This is nginx_main_template['conf_file_location'] if using nginxinc.nginx role + -dokuwiki_base: /var/www/html +# for apache +#dokuwiki_user: root +#dokuwiki_group: www-data +# for nginx +dokuwiki_user: nginx dokuwiki_group: www-data -dokuwiki_name: dokuwiki + +# Version to install +dokuwiki_version: stable # [stable, old_stable, development] + +dokuwiki_server_name: "localhost" +dokuwiki_base: /var/www/dokuwiki +dokuwiki_savedir: /var/www/dokuwiki/data + + +dokuwiki_name: "dokuwiki" dokuwiki_plugins_remove: - name: authad - name: authldap @@ -12,10 +30,7 @@ dokuwiki_plugins_remove: - name: authpgsql - name: info - name: popularity -dokuwiki_provision: false -dokuwiki_savedir: /var/www/html/data -dokuwiki_source: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz -dokuwiki_user: root +#dokuwiki_source: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz # Template parameters (will only be used when dokuwiki_provision is true) dokuwiki_acl_all: 0 diff --git a/handlers/main.yml b/handlers/main.yml index d45d4ca..c8fcfd1 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -4,3 +4,13 @@ service: name: apache2 state: restarted + +- name: restart nginx + service: + name: nginx + state: restarted + +- name: restart php-fpm + service: + name: php*-fpm + state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index 1802213..3a48cfc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,6 +2,9 @@ # tasks file for PeterMosmans.dokuwiki # Variable setup. +- name: Include Generic variables. + include_vars: "{{ ansible_os_family }}.yml" + - name: Include OS-specific variables. include_vars: "{{ ansible_os_family }}.yml" @@ -184,6 +187,30 @@ - permission - upgrade +- name: Configure nginx and deploy Dokuwiki + block: + - name: Ensure Nginx conf.d exists + file: + path: "{{ nginx_main_template['conf_file_location'] }}/conf.d" + state: directory + group: "{{ dokuwiki_group }}" + owner: "{{ dokuwiki_user }}" + mode: "0770" + + - name: Create dokuwiki nginx config file and restart Nginx + template: + src: nginx.dokuwiki.conf.j2 + dest: "/etc/nginx/conf.d/{{ dokuwiki_name }}.conf" + owner: root + group: root + mode: "0640" + tags: + - templates + notify: + - restart nginx + #when: dokuwiki_webserver is defined and dokuwiki_webserver == "nginx" + when: dokuwiki_webserver == "nginx" + - block: - name: Apply and deploy Apache configuration for Dokuwiki template: @@ -204,3 +231,6 @@ - restart apache2 when: dokuwiki_configure_apache2 is defined and dokuwiki_configure_apache2 + + + \ No newline at end of file diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 783f16e..d0c1be6 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -1,32 +1,89 @@ --- -- name: Install required packages - apt: +- name: Setup PHP-FPM + block: + # - name: Make sure /run/php directory exists (workaround for php-fpm sock bug) + # file: + # path: "/var/run/php/" + # group: root + # owner: root + # mode: "0755" + # state: directory + - name: Install PHP-FPM + become: true + package: + name: php-fpm + state: latest + install_recommends: false + + - name: Configure PGP-FPM Pool + template: + src: php-fpm.www.conf.j2 + dest: "/etc/php/7.2/fpm/pool.d/www.conf" + mode: "0644" + group: root + owner: root + notify: + - restart php-fpm + + - name: Add nginx user to group www-data (php-fpm permissions) + user: + name: "nginx" + groups: "www-data" + append: yes + + +- name: Install Required Dependencies + become: true + package: name: "{{ item }}" - state: present + state: latest install_recommends: false - with_items: - - ca-certificates - - openssl - - php5-gd - - php5-sqlite - - tar - - unzip - - zip + with_items: "{{ dokuwiki_dependencies + dokuwiki_recommendations }}" + - name: Make sure Dokuwiki base directory exists (workaround for Ansible bug) file: path: "{{ dokuwiki_base }}" - state: directory + group: "{{ dokuwiki_group }}" + owner: "{{ dokuwiki_user }}" + mode: "0770" + state: directory -- name: Download and extract latest version of Dokuwiki +- name: Download and extract Dokuwiki Stable + become: true unarchive: - src: "{{ dokuwiki_url }}" + src: "{{ dokuwiki_stable_url }}" + remote_src: yes dest: "{{ dokuwiki_base }}" - remote_src: true - extra_opts: ['--strip-components=1'] + extra_opts: ['--strip-components=1'] # remove first dir group: "{{ dokuwiki_group }}" owner: "{{ dokuwiki_user }}" - mode: "0750" + when: dokuwiki_version == "stable" + tags: + - upgrade + +- name: Download and extract Dokuwiki Old Stable + become: true + unarchive: + src: "{{ dokuwiki_old_stable_url }}" + remote_src: yes + dest: "{{ dokuwiki_base }}" + extra_opts: ['--strip-components=1'] # remove first dir + group: "{{ dokuwiki_group }}" + owner: "{{ dokuwiki_user }}" + when: dokuwiki_version == "old_stable" tags: - upgrade +- name: Download and extract Dokuwiki Development + become: true + unarchive: + src: "{{ dokuwiki_development_url }}" + remote_src: yes + dest: "{{ dokuwiki_base }}" + extra_opts: ['--strip-components=1'] # remove first dir + group: "{{ dokuwiki_group }}" + owner: "{{ dokuwiki_user }}" + when: dokuwiki_version == "development" + tags: + - upgrade diff --git a/templates/nginx.dokuwiki.conf.j2 b/templates/nginx.dokuwiki.conf.j2 new file mode 100644 index 0000000..1dc4668 --- /dev/null +++ b/templates/nginx.dokuwiki.conf.j2 @@ -0,0 +1,63 @@ +server { + server_name {{ dokuwiki_server_name }}; + listen 80; + autoindex off; + client_max_body_size 15M; + client_body_buffer_size 128k; + index index.html index.htm index.php doku.php; + # access_log /var/log/nginx/{{ dokuwiki_server_name }}/access.log; + # error_log /var/log/nginx/{{ dokuwiki_server_name }}/error.log; + root {{ dokuwiki_base }}; + + location / { + try_files $uri $uri/ @dokuwiki; + } + + location ~ ^/lib.*\.(gif|png|ico|jpg)$ { + expires 30d; + } + + location = /robots.txt { access_log off; log_not_found off; } + location = /favicon.ico { access_log off; log_not_found off; } + location ~ /\. { access_log off; log_not_found off; deny all; } + location ~ ~$ { access_log off; log_not_found off; deny all; } + + location @dokuwiki { + rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last; + rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last; + rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last; + rewrite ^/(.*) /doku.php?id=$1 last; + } + + location ~ \.php$ { + try_files $uri =404; + # fastcgi_pass unix:/var/run/php-fpm/{{ dokuwiki_server_name }}.sock; + fastcgi_pass unix:/var/run/php7.2-fpm.sock; + fastcgi_index index.php; + #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_FILENAME $request_filename; + include /etc/nginx/fastcgi_params; + fastcgi_param QUERY_STRING $query_string; + fastcgi_param REQUEST_METHOD $request_method; + fastcgi_param CONTENT_TYPE $content_type; + fastcgi_param CONTENT_LENGTH $content_length; + fastcgi_intercept_errors on; + fastcgi_ignore_client_abort off; + fastcgi_connect_timeout 60; + fastcgi_send_timeout 180; + fastcgi_read_timeout 180; + fastcgi_buffer_size 128k; + fastcgi_buffers 4 256k; + fastcgi_busy_buffers_size 256k; + fastcgi_temp_file_write_size 256k; + } + + location ~ /(data|conf|bin|inc)/ { + deny all; + } + + location ~ /\.ht { + deny all; + } + +} \ No newline at end of file diff --git a/templates/php-fpm.www.conf.j2 b/templates/php-fpm.www.conf.j2 new file mode 100644 index 0000000..a2fea82 --- /dev/null +++ b/templates/php-fpm.www.conf.j2 @@ -0,0 +1,17 @@ +[www] + +user = {{ dokuwiki_user }} +group = {{ dokuwiki_group }} + +; Changed because tmpfiles.d isn't working +listen = /run/php7.2-fpm.sock + +listen.owner = {{ dokuwiki_user }} +listen.group = {{ dokuwiki_group }} +;listen.mode = 0660 +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 + diff --git a/vars/Debian.yml b/vars/Debian.yml index 00a564e..81c5691 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,2 +1,28 @@ --- # vars file for PeterMosmans.dokuwiki +dokuwiki_dependencies: + - javascript-common + - libjs-jquery + - libjs-jquery-cookie + - libjs-jquery-ui + - libphp-simplepie + - php + - php-geshi + - php-seclib + - php-xml + #- php-fpm + - ucf + +dokuwiki_recommendations: + - imagemagick + - php-gd + - php-ldap + +unused_for_now: + - ca-certificates + - openssl + - php5-gd + - php5-sqlite + - tar + - unzip + - zip diff --git a/vars/main.yml b/vars/main.yml index 00a564e..78a932a 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,2 +1,5 @@ --- # vars file for PeterMosmans.dokuwiki +dokuwiki_stable_url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz +dokuwiki_old_stable_url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-oldstable.tgz +dokuwiki_development_url: http://github.com/splitbrain/dokuwiki/tarball/master \ No newline at end of file From 1101a46394ed2eb08d7467799d12210cda841c3d Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Mon, 5 Aug 2019 16:49:10 +0100 Subject: [PATCH 2/9] Making the config PHP version agnostic - as much as possible --- tasks/main.yml | 6 +++--- tasks/setup-Debian.yml | 32 ++++++++++++++++++++++---------- templates/nginx.dokuwiki.conf.j2 | 2 +- templates/php-fpm.www.conf.j2 | 2 +- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3a48cfc..29595e0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -191,10 +191,10 @@ block: - name: Ensure Nginx conf.d exists file: - path: "{{ nginx_main_template['conf_file_location'] }}/conf.d" + path: "{{ dokuwiki_webserver_nginx_conf }}/conf.d" state: directory - group: "{{ dokuwiki_group }}" - owner: "{{ dokuwiki_user }}" + group: root + owner: root mode: "0770" - name: Create dokuwiki nginx config file and restart Nginx diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index d0c1be6..78ab712 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -1,13 +1,6 @@ --- - name: Setup PHP-FPM block: - # - name: Make sure /run/php directory exists (workaround for php-fpm sock bug) - # file: - # path: "/var/run/php/" - # group: root - # owner: root - # mode: "0755" - # state: directory - name: Install PHP-FPM become: true package: @@ -15,10 +8,23 @@ state: latest install_recommends: false + - name: Find the conf.d dir, making this php version agnostic + find: + paths: "/etc/php/" + patterns: "pool.d" + recurse: yes + file_type: directory + register: dokuwiki_phpfpm_confd + + - name: DEBUG THIS FUCK + debug: + var: dokuwiki_phpfpm_confd.files[0].path + - name: Configure PGP-FPM Pool template: src: php-fpm.www.conf.j2 - dest: "/etc/php/7.2/fpm/pool.d/www.conf" + #dest: "/etc/php/*/fpm/pool.d/www.conf" + dest: "{{ dokuwiki_phpfpm_confd.files[0].path }}/www.conf" mode: "0644" group: root owner: root @@ -31,6 +37,8 @@ groups: "www-data" append: yes + when: dokuwiki_webserver == "nginx" +# - name: Install Required Dependencies become: true @@ -39,8 +47,8 @@ state: latest install_recommends: false with_items: "{{ dokuwiki_dependencies + dokuwiki_recommendations }}" +# - - name: Make sure Dokuwiki base directory exists (workaround for Ansible bug) file: path: "{{ dokuwiki_base }}" @@ -48,6 +56,7 @@ owner: "{{ dokuwiki_user }}" mode: "0770" state: directory +# - name: Download and extract Dokuwiki Stable become: true @@ -61,7 +70,8 @@ when: dokuwiki_version == "stable" tags: - upgrade - +# + - name: Download and extract Dokuwiki Old Stable become: true unarchive: @@ -74,6 +84,7 @@ when: dokuwiki_version == "old_stable" tags: - upgrade +# - name: Download and extract Dokuwiki Development become: true @@ -87,3 +98,4 @@ when: dokuwiki_version == "development" tags: - upgrade +# \ No newline at end of file diff --git a/templates/nginx.dokuwiki.conf.j2 b/templates/nginx.dokuwiki.conf.j2 index 1dc4668..48e7dd8 100644 --- a/templates/nginx.dokuwiki.conf.j2 +++ b/templates/nginx.dokuwiki.conf.j2 @@ -32,7 +32,7 @@ server { location ~ \.php$ { try_files $uri =404; # fastcgi_pass unix:/var/run/php-fpm/{{ dokuwiki_server_name }}.sock; - fastcgi_pass unix:/var/run/php7.2-fpm.sock; + fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $request_filename; diff --git a/templates/php-fpm.www.conf.j2 b/templates/php-fpm.www.conf.j2 index a2fea82..e077327 100644 --- a/templates/php-fpm.www.conf.j2 +++ b/templates/php-fpm.www.conf.j2 @@ -4,7 +4,7 @@ user = {{ dokuwiki_user }} group = {{ dokuwiki_group }} ; Changed because tmpfiles.d isn't working -listen = /run/php7.2-fpm.sock +listen = /run/php-fpm.sock listen.owner = {{ dokuwiki_user }} listen.group = {{ dokuwiki_group }} From f66072b54d20f97060d0b85deeae9e74a3fcf617 Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Tue, 13 Aug 2019 14:52:17 +0100 Subject: [PATCH 3/9] Now installing plugins cia gittool. Supports all types of plugin. Test driving new doc format. --- README.md | 97 ++++++++++------------ defaults/main.yml | 64 ++++++++++++++- tasks/main.yml | 135 +++++++++++++++++-------------- tasks/setup-Debian.yml | 1 - templates/local.php.j2 | 7 +- templates/nginx.dokuwiki.conf.j2 | 5 +- vars/Debian.yml | 7 +- 7 files changed, 188 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index db1cd99..35020e3 100644 --- a/README.md +++ b/README.md @@ -19,55 +19,51 @@ A webserver having PHP installed, e.g. by using PeterMosmans.apache2 Role Variables -------------- -Available variables are listed below, along with default values. The default -values are specified in `default/main.yml`. - -**dokuwiki_configure_apache2**: When true, will deploy an Apache configuration -(`dokuwiki.conf.j2`) to Apache, and enable the site. By default, the variable is -undefined (false). - - -**dokuwiki_name**: The 'internal' name of the dokuwiki, which is e.g. used for -Apache logfiles and the cleanup cronjob. (when `dokuwiki_configure_apache2` is -true). This allows the Ansible role to be used for multiple Dokuwiki sites on -the same server. Default: -``` -dokuwiki_name: dokuwiki -``` - +Dependencies and package related variables are defined in `vars/*`. This includes all dependencies for dokuwiki and recommended plugins, as well as the location of all dokuwiki branches. You can select which branch to install with `dokuwiki_version` -**dokuwiki_source**: The URL where the (latest) version of Dokuwiki can be -found. By default, it uses the official Dokuwiki source. -``` -dokuwiki_source: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz -``` - - -**dokuwiki_base**: The local path where Dokuwiki will be installed. -``` -dokuwiki_base: /var/www/html -``` +| Variable | Comments | +| :--- | :--- | +| `dokuwiki_stable_url` | `dokuwiki_stable_url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz` | +| `dokuwiki_old_stable_url` | `dokuwiki_old_stable_url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-oldstable.tgz` | +| `dokuwiki_development_url` | `dokuwiki_development_url: http://github.com/splitbrain/dokuwiki/tarball/master` | -**dokuwiki_group**: The group owning the Dokuwiki files. -``` -dokuwiki_group: www-data -``` - - -**dokuwiki_plugins**: A list of name / source pairs, with plugins to -automatically install. The sources need to point to tar or .tgz sources (e.g.). -Example: -``` - - name: pagelist - src: https://github.com/dokufreaks/plugin-pagelist/tarball/master -``` - +Available variables are listed below, along with default values. The default +values are specified in `default/main.yml`. -**dokuwiki_plugins_remove**: A list of plugins to automatically remove upon -installation or upgrade. -Default: -``` +| Variable | Comments | +| :--- | :--- | +| `dokuwiki_version` | Version to install. `dokuwiki_version: stable` | +| `dokuwiki_configure_apache2` | When true, will deploy an Apache configuration (`dokuwiki.conf.j2`) to Apache, and enable the site. `dokuwiki_configure_apache2: false`. | +| `dokuwiki_name` | The 'internal' name of the dokuwiki, which is e.g. used for Apache logfiles and the cleanup cronjob. (when `dokuwiki_configure_apache2` is true). This allows the Ansible role to be used for multiple Dokuwiki sites on the same server. Default: `dokuwiki_name: dokuwiki` | +| `dokuwiki_base` | The local path where Dokuwiki will be installed. `dokuwiki_base: /var/www/html` | +| `dokuwiki_user` | The user owning the Dokuwiki files. `dokuwiki_user: root` | +| `dokuwiki_group` | The group owning the Dokuwiki files. `dokuwiki_group: www-data` | +| `dokuwiki_plugins` | List of name / source pairs, with plugins to automatically install via dokuwiki's gittool. (1) | +| `dokuwiki_plugins_remove` | A list of plugins to automatically remove upon installation or upgrade. (2) | +| `dokuwiki_provision` | When true, apply configuration templates to provision Dokuwiki. `dokuwiki_provision: true` (3) | +| `` | | + + + +(1) The current, opinionated list of default plugins is: +```Yaml +dokuwiki_plugins: + - name: pagelist + - name: fastwiki + - name: edittable + - name: dw2pdf + - name: bookcreator + - name: tag + - name: discussion + - name: dropfiles + - name: color + - name: nspages + - name: sortablejs +``` + +(2) The default list of plugins to remove is: +```Yaml dokuwiki_plugins_remove: - name: authad - name: authldap @@ -79,8 +75,7 @@ dokuwiki_plugins_remove: ``` -**dokuwiki_provision**: When true, apply configuration templates to provision -Dokuwiki. If not specified or false, Dokuwiki will be unprovisioned, a default +(3) If not specified or false, Dokuwiki will be unprovisioned, a default installation. See below in the provisioning chapter which variables can be used in the configuration templates. Note that when this variable is true, it will (re-)template and overwrite the current Dokuwiki configuration. @@ -91,10 +86,6 @@ The following configuration files are templated: - `/conf/plugins.local.php` - `/conf/users.auth.php` -Example: -``` -dokuwiki_provision: true -``` **dokuwiki_savedir**: The directory where all files (content) will be stored. @@ -113,10 +104,6 @@ dokuwiki_templates: ``` -**dokuwiki_user**: The user owning the Dokuwiki files. -``` -dokuwiki_user: root -``` ## Provisioning diff --git a/defaults/main.yml b/defaults/main.yml index 52d2c46..2184560 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,8 +20,36 @@ dokuwiki_server_name: "localhost" dokuwiki_base: /var/www/dokuwiki dokuwiki_savedir: /var/www/dokuwiki/data +dokuwiki_plugins: + - name: pagelist + src: https://github.com/dokufreaks/plugin-pagelist/tarball/master + # Lists pages in a nice looking table or unordered list. + - name: fastwiki + src: https://github.com/zioth/dokuwiki_fastwiki/archive/master.zip + - name: edittable + src: https://github.com/cosmocode/edittable/archive/master.zip + - name: dw2pdf + src: https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/tarball/master + - name: bookcreator + src: https://github.com/Klap-in/dokuwiki-plugin-bookcreator/archive/master.zip + - name: tag + src: https://github.com/dokufreaks/plugin-tag/tarball/master + # Assign category tags to wiki pages + - name: discussion + src: https://github.com/dokufreaks/plugin-discussion/archive/master.zip + - name: dropfiles + src: https://github.com/cosmocode/dokuwiki-plugin-dropfiles/zipball/master + # Drop files into the edit area to upload them + - name: color + src: https://github.com/hanche/dokuwiki_color_plugin/archive/2018-10-12.zip + # Opportunity to write colored text in DokuWiki + - name: nspages + src: https://github.com/gturri/nspages/zipball/master + # Present a table of contents of the pages of a selected namespace + - name: sortablejs + src: https://github.com/FyiurAmron/sortablejs/zipball/master + #JavaScript for sortable tables -dokuwiki_name: "dokuwiki" dokuwiki_plugins_remove: - name: authad - name: authldap @@ -30,13 +58,41 @@ dokuwiki_plugins_remove: - name: authpgsql - name: info - name: popularity -#dokuwiki_source: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz + # Template parameters (will only be used when dokuwiki_provision is true) dokuwiki_acl_all: 0 dokuwiki_acl_user: 8 -dokuwiki_disableactions: "register" dokuwiki_local: - name: "['passcrypt']" value: 'bcrypt' -dokuwiki_title: "default Dokuwiki site" + - name: "['gzip_output']" + value: '1' + - name: "['updatecheck']" + value: '0' + +# Dokuwiki config options +dokuwiki_name: "dokuwiki" +dokuwiki_title: "Default Dokuwiki site" +dokuwiki_opt_lang: "en" +#dokuwiki_opt_superuser: "root" +#dokuwiki_opt_fullname: "root" +#dokuwiki_opt_email: "root" +#dokuwiki_opt_password: "root" +dokuwiki_opt_acl: "1" +# dokuwiki_opt_policy +# 0 - Open Wiki (read, write, upload for everyone) +# 1 - Public Wiki (read for everyone, write and upload for registered users) +# 2 - Closed Wiki (read, write, upload for registered users only) +dokuwiki_opt_policy: "0" +dokuwiki_disableactions: "register" +#dokuwiki_opt_licence +#cc-zero - CC0 1.0 Universal http://creativecommons.org/publicdomain/zero/1.0/ +#publicdomain - Public Domain http://creativecommons.org/licenses/publicdomain/ +#cc-by - CC Attribution 4.0 International http://creativecommons.org/licenses/by/4.0/ +#cc-by-sa - CC Attribution-Share Alike 4.0 International http://creativecommons.org/licenses/by-sa/4.0/ +#gnufdl - GNU Free Documentation License 1.3 http://www.gnu.org/licenses/fdl-1.3.html +#cc-by-nc - CC Attribution-Noncommercial 4.0 International http://creativecommons.org/licenses/by-nc/4.0/ +#cc-by-nc-sa - CC Attribution-Noncommercial-Share Alike 4.0 International http://creativecommons.org/licenses/by-nc-sa/4.0/ +#0 - Do not show any license information +dokuwiki_opt_license: "0" diff --git a/tasks/main.yml b/tasks/main.yml index 29595e0..0f1b286 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -68,75 +68,92 @@ - provision when: dokuwiki_provision -- name: Remove (previous versions of) plugins - file: - path: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" - state: absent - with_flattened: - - "{{ dokuwiki_plugins|default([]) }}" - - "{{ dokuwiki_plugins_remove|default([]) }}" - tags: - - plugins - - upgrade - -- name: Recreate directory for each plugin (workaround for Ansible bug) - file: - path: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" - state: directory - group: "{{ dokuwiki_group }}" - owner: "{{ dokuwiki_user }}" - with_items: "{{ dokuwiki_plugins|default([]) }}" - tags: - - plugins - - upgrade - -- name: Download and install latest version of plugins - unarchive: - src: "{{ item.src }}" - dest: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" - remote_src: true - extra_opts: ['--strip-components=1'] - group: "{{ dokuwiki_group }}" - owner: "{{ dokuwiki_user }}" - mode: "0770" +# - name: Remove (previous versions of) plugins +# file: +# path: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" +# state: absent +# with_flattened: +# - "{{ dokuwiki_plugins|default([]) }}" +# - "{{ dokuwiki_plugins_remove|default([]) }}" +# tags: +# - plugins +# - upgrade + +# - name: Recreate directory for each plugin (workaround for Ansible bug) +# file: +# path: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" +# state: directory +# group: "{{ dokuwiki_group }}" +# owner: "{{ dokuwiki_user }}" +# with_items: "{{ dokuwiki_plugins|default([]) }}" +# tags: +# - plugins +# - upgrade + +- name: Download and install latest version of plugins via Dokuwiki's gittool + become: yes + shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install {{item.name}}" with_items: "{{ dokuwiki_plugins|default([]) }}" tags: - plugins - upgrade -- name: Remove previous versions of templates - file: - path: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" - state: absent - with_items: "{{ dokuwiki_templates|default([]) }}" - tags: - - templates - - upgrade - -- name: Recreate directory for each template (workaround for Ansible bug) - file: - path: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" - state: directory - group: "{{ dokuwiki_group }}" - owner: "{{ dokuwiki_user }}" +- name: Download and install latest version of templates via Dokuwiki's gittool + become: yes + shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install {{item.name}}" with_items: "{{ dokuwiki_templates|default([]) }}" tags: - templates - upgrade -- name: Download and install latest version of templates - unarchive: - src: "{{ item.src }}" - dest: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" - remote_src: true - extra_opts: ['--strip-components=1'] - group: "{{ dokuwiki_group }}" - owner: "{{ dokuwiki_user }}" - mode: "0770" - with_items: "{{ dokuwiki_templates|default([]) }}" - tags: - - templates - - upgrade +# - name: Download and install latest version of plugins +# become: yes +# unarchive: +# src: "{{ item.src }}" +# dest: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" +# remote_src: true +# extra_opts: ['--strip-components=1'] +# group: "{{ dokuwiki_group }}" +# owner: "{{ dokuwiki_user }}" +# #mode: "0770" +# with_items: "{{ dokuwiki_plugins|default([]) }}" +# tags: +# - plugins +# - upgrade + +# - name: Remove previous versions of templates +# file: +# path: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" +# state: absent +# with_items: "{{ dokuwiki_templates|default([]) }}" +# tags: +# - templates +# - upgrade + +# - name: Recreate directory for each template (workaround for Ansible bug) +# file: +# path: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" +# state: directory +# group: "{{ dokuwiki_group }}" +# owner: "{{ dokuwiki_user }}" +# with_items: "{{ dokuwiki_templates|default([]) }}" +# tags: +# - templates +# - upgrade + +# - name: Download and install latest version of templates +# unarchive: +# src: "{{ item.src }}" +# dest: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" +# remote_src: true +# extra_opts: ['--strip-components=1'] +# group: "{{ dokuwiki_group }}" +# owner: "{{ dokuwiki_user }}" +# mode: "0770" +# with_items: "{{ dokuwiki_templates|default([]) }}" +# tags: +# - templates +# - upgrade - name: Customize template using online files get_url: diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 78ab712..50ceef4 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -23,7 +23,6 @@ - name: Configure PGP-FPM Pool template: src: php-fpm.www.conf.j2 - #dest: "/etc/php/*/fpm/pool.d/www.conf" dest: "{{ dokuwiki_phpfpm_confd.files[0].path }}/www.conf" mode: "0644" group: root diff --git a/templates/local.php.j2 b/templates/local.php.j2 index a925c0e..ba59f56 100644 --- a/templates/local.php.j2 +++ b/templates/local.php.j2 @@ -1,14 +1,15 @@ Date: Mon, 19 Aug 2019 10:09:48 +0100 Subject: [PATCH 4/9] Changed the README, renamed some templates, fixed gittool template installation. --- README.md | 113 ++++++++++-------- defaults/main.yml | 71 ++++++----- handlers/main.yml | 2 +- tasks/main.yml | 28 +---- tasks/setup-Debian.yml | 14 ++- ...kuwiki.conf.j2 => apache.dokuwiki.conf.j2} | 0 vars/Debian.yml | 10 +- 7 files changed, 121 insertions(+), 117 deletions(-) rename templates/{dokuwiki.conf.j2 => apache.dokuwiki.conf.j2} (100%) diff --git a/README.md b/README.md index 35020e3..b4911e3 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ A webserver having PHP installed, e.g. by using PeterMosmans.apache2 Role Variables -------------- + + +### /vars + Dependencies and package related variables are defined in `vars/*`. This includes all dependencies for dokuwiki and recommended plugins, as well as the location of all dokuwiki branches. You can select which branch to install with `dokuwiki_version` | Variable | Comments | @@ -27,26 +31,30 @@ Dependencies and package related variables are defined in `vars/*`. This include | `dokuwiki_old_stable_url` | `dokuwiki_old_stable_url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-oldstable.tgz` | | `dokuwiki_development_url` | `dokuwiki_development_url: http://github.com/splitbrain/dokuwiki/tarball/master` | +### /defaults -Available variables are listed below, along with default values. The default -values are specified in `default/main.yml`. +All other available variables are listed below, along with default values. The default values are specified in `default/main.yml`. | Variable | Comments | | :--- | :--- | +| `dokuwiki_server_name` | Dokuwiki ServerName Directive. `dokuwiki_server_name: "localhost"` | +| `dokuwiki_base` | Dokuwiki base directory. `dokuwiki_base: /var/www/dokuwiki` | +| `dokuwiki_savedir` | Dokuwiki data directory. `dokuwiki_savedir: /var/www/dokuwiki/data` | | `dokuwiki_version` | Version to install. `dokuwiki_version: stable` | | `dokuwiki_configure_apache2` | When true, will deploy an Apache configuration (`dokuwiki.conf.j2`) to Apache, and enable the site. `dokuwiki_configure_apache2: false`. | | `dokuwiki_name` | The 'internal' name of the dokuwiki, which is e.g. used for Apache logfiles and the cleanup cronjob. (when `dokuwiki_configure_apache2` is true). This allows the Ansible role to be used for multiple Dokuwiki sites on the same server. Default: `dokuwiki_name: dokuwiki` | | `dokuwiki_base` | The local path where Dokuwiki will be installed. `dokuwiki_base: /var/www/html` | | `dokuwiki_user` | The user owning the Dokuwiki files. `dokuwiki_user: root` | | `dokuwiki_group` | The group owning the Dokuwiki files. `dokuwiki_group: www-data` | -| `dokuwiki_plugins` | List of name / source pairs, with plugins to automatically install via dokuwiki's gittool. (1) | -| `dokuwiki_plugins_remove` | A list of plugins to automatically remove upon installation or upgrade. (2) | -| `dokuwiki_provision` | When true, apply configuration templates to provision Dokuwiki. `dokuwiki_provision: true` (3) | -| `` | | +| `dokuwiki_plugins` (1) | List of name / source pairs, with plugins to automatically install via dokuwiki's gittool. | +| `dokuwiki_plugins_remove` (2) | A list of plugins to automatically remove upon installation or upgrade. | +| `dokuwiki_templates` (3) | A list of templates to automatically install. | +| `dokuwiki_provision` (4) | When true, apply configuration templates to provision Dokuwiki. `dokuwiki_provision: true` | +| `dokuwiki_savedir` | The directory where all files (content) will be stored. See [Dokuwiki Security - Move Directories out of DocRoot](https://www.dokuwiki.org/security#move_directories_out_of_docroot) for more info. `dokuwiki_savedir: /var/www/html/data` | -(1) The current, opinionated list of default plugins is: +(1) `dokuwiki_plugins`: The current, opinionated list of default plugins is: ```Yaml dokuwiki_plugins: - name: pagelist @@ -62,7 +70,7 @@ dokuwiki_plugins: - name: sortablejs ``` -(2) The default list of plugins to remove is: +(2) `dokuwiki_plugins_remove`: The default list of plugins to remove is: ```Yaml dokuwiki_plugins_remove: - name: authad @@ -74,70 +82,63 @@ dokuwiki_plugins_remove: - name: popularity ``` - -(3) If not specified or false, Dokuwiki will be unprovisioned, a default -installation. See below in the provisioning chapter which variables can be used -in the configuration templates. Note that when this variable is true, it will -(re-)template and overwrite the current Dokuwiki configuration. - -The following configuration files are templated: -- `/conf/acl.auth.php` -- `/conf/local.php` -- `/conf/plugins.local.php` -- `/conf/users.auth.php` - - - -**dokuwiki_savedir**: The directory where all files (content) will be stored. -``` -dokuwiki_savedir: /var/www/html/data -``` - - -**dokuwiki_templates**: A list of name / source pairs, with templates to -automatically install. The sources need to point to tar or .tgz sources (e.g.). -Example: -``` +(3) `dokuwiki_templates`: A list of templates to install +```Yaml dokuwiki_templates: - name: bootstrap3 - src: https://github.com/LotarProject/dokuwiki-template-bootstrap3/tarball/master ``` +(4) `dokuwiki_provision`: If not specified or false, Dokuwiki will be unprovisioned, a default +installation. See below in the provisioning chapter which variables can be used +in the configuration templates. Note that when this variable is true, it will +(re-)template and overwrite the current Dokuwiki configuration. -## Provisioning -The following variables will be used in the configuration templates -(`local.php.j2`, `users.auth.php.j2`), and therefore will only be applied if -`dokuwiki_provision` is set to `true`. -**dokuwiki_acl_all**: The ACL bits for the default (@ALL) group. By default, -only logged on users are allowed access (0). +Configuration templates +-------------- +The following configuration files, located at `conf/*`, are templated: -**dokuwiki_acl_user**: The ACL bits for the user (@user) group. By default, -users have upload, create, edit, and read permissions (8). +| Template | Comments | +| :--- | :--- | +| `acl.auth.php.j2` | Dokuwiki ACL Config file | +| `cleanup.sh.j2` | Cron job to cleanup DokuWiki installations | +| `local.php.j2` | Dokuwiki's Main Configuration File - Local Settings | +| `php-fpm.www.conf.j2` | PHP FPM config file - altered to make this role php version agnostic | +| `plugins.local.php.j2` | Local plugin enable/disable settings - recommended to be used with `dokuwiki_plugins_removed` | +| `users.auth.php.j2` | If dokuwiki_users is defined, this file is provisioned with those local users | +| `apache.dokuwiki.conf.j2` | Apache config for dokuwiki | +| `nginx.dokuwiki.conf.j2` | Nginx config for dokuwiki | -**dokuwiki_disableactions**: Which actions to disable. By default, registering -is disabled. +## Provisioning +The following variables will be used in the configuration templates, and therefore will only be applied if +`dokuwiki_provision` is set to `true`. +| Template | Comments | +| :--- | :--- | +| `dokuwiki_title` | The Dokuwiki title | +| `dokuwiki_acl_all` | The ACL bits for the default (@ALL) group. By default, only logged on users are allowed access (0). | +| `dokuwiki_acl_user` | The ACL bits for the user (@user) group. By default, users have upload, create, edit, and read permissions (8). | +| `dokuwiki_disableactions` | Which actions to disable. By default, user auto registering is disabled. | +| `dokuwiki_local` (1) | A list of name / value configuration pairs to be added to the `local.php` configuration file. | +| `dokuwiki_users ` | A list of users | -**dokuwiki_title**: The Dokuwiki title -**dokuwiki_local**: A list of name / value configuration pairs to be added to -the `local.php` configuration file. -Example: -``` +(1) `dokuwiki_local`: You can add additional parameters to the `local.php` configuration file, as seen here: +```Yaml dokuwiki_local: - name: "['passcrypt']" value: 'bcrypt' ``` + This will result in adding the following string to `/conf/local.php`: -``` -$conf['mytemplate'] = 'myvalue'; +```Yaml +$conf['passcrypt'] = 'bcrypt'; ``` @@ -162,6 +163,8 @@ dokuwiki_users: This will result in adding the user admin to Dokuwiki, with the bcrypted password `admin`. + + Dependencies ------------ @@ -170,7 +173,7 @@ None. Example Playbook ---------------- -``` +```Yaml - hosts: all become: yes become_method: sudo @@ -205,6 +208,7 @@ Example Playbook email: admin@admin groups: admin,user ``` + This example will install Dokuwiki to `/var/www/html`, and use `/var/www/html/data` as data directory. It will install the plugins `tag` and `pagelist`, and remove the plugins `authad`, `authldap`, `authmysql`, `authpdo`, `authpgsql`, `info` and `popularity`. It will install and use the `bootstrap3` theme, and grant the user `admin` with the password `admin` access to the wiki. @@ -220,7 +224,10 @@ GPLv3 Author Information ------------------ -Created by Peter Mosmans. Suggestions, feedback and pull requests are always +Created by [Peter Mosmans](https://github.com/PeterMosmans). Suggestions, feedback and pull requests are always welcome. -Contributions by @onny +### Contributors + +- [Jonas Heinrich](https://github.com/onny) +- [B Cacheira](https://github.com/cacheira) \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml index 2184560..9a99556 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,35 +20,50 @@ dokuwiki_server_name: "localhost" dokuwiki_base: /var/www/dokuwiki dokuwiki_savedir: /var/www/dokuwiki/data +# dokuwiki_plugins: +# - name: pagelist +# src: https://github.com/dokufreaks/plugin-pagelist/tarball/master +# # Lists pages in a nice looking table or unordered list. +# - name: fastwiki +# src: https://github.com/zioth/dokuwiki_fastwiki/archive/master.zip +# - name: edittable +# src: https://github.com/cosmocode/edittable/archive/master.zip +# - name: dw2pdf +# src: https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/tarball/master +# - name: bookcreator +# src: https://github.com/Klap-in/dokuwiki-plugin-bookcreator/archive/master.zip +# - name: tag +# src: https://github.com/dokufreaks/plugin-tag/tarball/master +# # Assign category tags to wiki pages +# - name: discussion +# src: https://github.com/dokufreaks/plugin-discussion/archive/master.zip +# - name: dropfiles +# src: https://github.com/cosmocode/dokuwiki-plugin-dropfiles/zipball/master +# # Drop files into the edit area to upload them +# - name: color +# src: https://github.com/hanche/dokuwiki_color_plugin/archive/2018-10-12.zip +# # Opportunity to write colored text in DokuWiki +# - name: nspages +# src: https://github.com/gturri/nspages/zipball/master +# # Present a table of contents of the pages of a selected namespace +# - name: sortablejs +# src: https://github.com/FyiurAmron/sortablejs/zipball/master +# #JavaScript for sortable tables + dokuwiki_plugins: - - name: pagelist - src: https://github.com/dokufreaks/plugin-pagelist/tarball/master - # Lists pages in a nice looking table or unordered list. - - name: fastwiki - src: https://github.com/zioth/dokuwiki_fastwiki/archive/master.zip - - name: edittable - src: https://github.com/cosmocode/edittable/archive/master.zip - - name: dw2pdf - src: https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/tarball/master - - name: bookcreator - src: https://github.com/Klap-in/dokuwiki-plugin-bookcreator/archive/master.zip - - name: tag - src: https://github.com/dokufreaks/plugin-tag/tarball/master - # Assign category tags to wiki pages - - name: discussion - src: https://github.com/dokufreaks/plugin-discussion/archive/master.zip - - name: dropfiles - src: https://github.com/cosmocode/dokuwiki-plugin-dropfiles/zipball/master - # Drop files into the edit area to upload them - - name: color - src: https://github.com/hanche/dokuwiki_color_plugin/archive/2018-10-12.zip - # Opportunity to write colored text in DokuWiki - - name: nspages - src: https://github.com/gturri/nspages/zipball/master - # Present a table of contents of the pages of a selected namespace - - name: sortablejs - src: https://github.com/FyiurAmron/sortablejs/zipball/master - #JavaScript for sortable tables + - pagelist + - fastwiki + - edittable + - dw2pdf + - bookcreator + - tag + - discussion + - dropfiles + - color + - nspages + - sortablejs + + dokuwiki_plugins_remove: - name: authad diff --git a/handlers/main.yml b/handlers/main.yml index c8fcfd1..5bddec0 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -12,5 +12,5 @@ - name: restart php-fpm service: - name: php*-fpm + name: "{{ dokuwiki_phpfpm_service.files[0].path | basename | splitext | first }}" state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index 0f1b286..bed0ef4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -68,31 +68,9 @@ - provision when: dokuwiki_provision -# - name: Remove (previous versions of) plugins -# file: -# path: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" -# state: absent -# with_flattened: -# - "{{ dokuwiki_plugins|default([]) }}" -# - "{{ dokuwiki_plugins_remove|default([]) }}" -# tags: -# - plugins -# - upgrade - -# - name: Recreate directory for each plugin (workaround for Ansible bug) -# file: -# path: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" -# state: directory -# group: "{{ dokuwiki_group }}" -# owner: "{{ dokuwiki_user }}" -# with_items: "{{ dokuwiki_plugins|default([]) }}" -# tags: -# - plugins -# - upgrade - - name: Download and install latest version of plugins via Dokuwiki's gittool become: yes - shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install {{item.name}}" + shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install {{item}}" with_items: "{{ dokuwiki_plugins|default([]) }}" tags: - plugins @@ -100,7 +78,7 @@ - name: Download and install latest version of templates via Dokuwiki's gittool become: yes - shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install {{item.name}}" + shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install template:{{item.name}}" with_items: "{{ dokuwiki_templates|default([]) }}" tags: - templates @@ -231,7 +209,7 @@ - block: - name: Apply and deploy Apache configuration for Dokuwiki template: - src: dokuwiki.conf.j2 + src: apache.dokuwiki.conf.j2 dest: "/etc/apache2/sites-available/{{ dokuwiki_name }}.conf" owner: root group: root diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 50ceef4..04b0ac6 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -16,10 +16,14 @@ file_type: directory register: dokuwiki_phpfpm_confd - - name: DEBUG THIS FUCK - debug: - var: dokuwiki_phpfpm_confd.files[0].path - + - name: Register the PHP-FPM service name + find: + paths: "/lib/systemd/system/" + patterns: "php*fpm.service" + file_type: file + register: dokuwiki_phpfpm_service + # resulting service name will be "dokuwiki_phpfpm_service.files[0].path | basename | splitext | first"... yeah. + - name: Configure PGP-FPM Pool template: src: php-fpm.www.conf.j2 @@ -36,7 +40,7 @@ groups: "www-data" append: yes - when: dokuwiki_webserver == "nginx" + when: dokuwiki_webserver == "nginx" # - name: Install Required Dependencies diff --git a/templates/dokuwiki.conf.j2 b/templates/apache.dokuwiki.conf.j2 similarity index 100% rename from templates/dokuwiki.conf.j2 rename to templates/apache.dokuwiki.conf.j2 diff --git a/vars/Debian.yml b/vars/Debian.yml index 40f913b..3b1c405 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -20,8 +20,8 @@ dokuwiki_recommendations: - php-gd - php-ldap -unused_for_now: - - ca-certificates - - openssl - - php5-sqlite - - zip +# unused_for_now: +# - ca-certificates +# - openssl +# - php5-sqlite +# - zip From db2b55a4241a85a133eca1480a2d8e23ad81fd46 Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Mon, 19 Aug 2019 10:28:00 +0100 Subject: [PATCH 5/9] Added nginx to Requirements, http linked the roles. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4911e3..7bdba3c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Apache configuration file (which is included as template in the role). Requirements ------------ -A webserver having PHP installed, e.g. by using PeterMosmans.apache2 +A webserver having PHP installed. For Apache, we suggest using [PeterMosmans.apache2](https://github.com/PeterMosmans/ansible-role-apache2). If you prefer Nginx, please use [Nginxinc.nginx](https://github.com/nginxinc/ansible-role-nginx). Role Variables From 6ccd74a35d9dbf2dd61b9461d688e917394e2892 Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Wed, 21 Aug 2019 12:14:11 +0100 Subject: [PATCH 6/9] Added php-mbstring dependency for mPDF. Small README update --- README.md | 22 ++++++++++++++++------ vars/Debian.yml | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7bdba3c..7b0ccb1 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,8 @@ The following variables will be used in the configuration templates, and therefo | `dokuwiki_acl_user` | The ACL bits for the user (@user) group. By default, users have upload, create, edit, and read permissions (8). | | `dokuwiki_disableactions` | Which actions to disable. By default, user auto registering is disabled. | | `dokuwiki_local` (1) | A list of name / value configuration pairs to be added to the `local.php` configuration file. | -| `dokuwiki_users ` | A list of users | +| `dokuwiki_users ` (2) | A list of users | +| `dokuwiki_opt_license` (3) | The content license to use. `dokuwiki_opt_license: "0"` | @@ -141,9 +142,8 @@ This will result in adding the following string to `/conf/local.php`: $conf['passcrypt'] = 'bcrypt'; ``` - -**dokuwiki_users**: A list of users, containing the following name / value pairs: -``` +(2) `dokuwiki_users`: A list of users, containing the following name / value pairs: +```Yaml - login: login - hash: password hash - name: full name @@ -152,7 +152,7 @@ $conf['passcrypt'] = 'bcrypt'; ``` Example: -``` +```Yaml dokuwiki_users: - login: admin hash: "$2y$05$Nr3wFqH54gcdhxPK9easseLSVwLAnLTD2flYmQbAbCVIiiTU4mCjS" @@ -160,10 +160,20 @@ dokuwiki_users: email: admin@admin groups: admin,user ``` - This will result in adding the user admin to Dokuwiki, with the bcrypted password `admin`. +(3) `dokuwiki_opt_license`: The options for this are: +- cc-zero - [CC0 1.0 Universal](http://creativecommons.org/publicdomain/zero/1.0/) +- publicdomain - [Public Domain](http://creativecommons.org/licenses/publicdomain/) +- cc-by - [CC Attribution 4.0](International http://creativecommons.org/licenses/by/4.0/) +- cc-by-sa - [CC Attribution-Share Alike 4.0](International http://creativecommons.org/licenses/by-sa/4.0/) +- gnufdl - [GNU Free Documentation License 1.3](http://www.gnu.org/licenses/fdl-1.3.html) +- cc-by-nc - [CC Attribution-Noncommercial 4.0](International http://creativecommons.org/licenses/by-nc/4.0/) +- cc-by-nc-sa - [CC Attribution-Noncommercial-Share Alike 4.0](International http://creativecommons.org/licenses/by-nc-sa/4.0/) +- 0 - Do not show any license information + + Dependencies ------------ diff --git a/vars/Debian.yml b/vars/Debian.yml index 3b1c405..c38dd04 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -11,6 +11,7 @@ dokuwiki_dependencies: - php-seclib - php-xml - php-gd + - php-mbstring - ucf - unzip - tar From 5c3c8d6d10fe33a845b38ca83ce887c607d11392 Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Wed, 21 Aug 2019 15:07:38 +0100 Subject: [PATCH 7/9] Made the list of enabled/disabled plugins dynamic, reordered a few tasks, changed dokuwiki_plugins_remove variable format. README updated too --- README.md | 45 ++++++++++++++++---------------- defaults/main.yml | 47 +++++----------------------------- tasks/main.yml | 31 +++++++++++----------- tasks/setup-Debian.yml | 17 ++++++------ templates/plugins.local.php.j2 | 17 +++++++++--- 5 files changed, 67 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 7b0ccb1..7742eba 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Role Variables -------------- - ### /vars Dependencies and package related variables are defined in `vars/*`. This includes all dependencies for dokuwiki and recommended plugins, as well as the location of all dokuwiki branches. You can select which branch to install with `dokuwiki_version` @@ -57,29 +56,29 @@ All other available variables are listed below, along with default values. The d (1) `dokuwiki_plugins`: The current, opinionated list of default plugins is: ```Yaml dokuwiki_plugins: - - name: pagelist - - name: fastwiki - - name: edittable - - name: dw2pdf - - name: bookcreator - - name: tag - - name: discussion - - name: dropfiles - - name: color - - name: nspages - - name: sortablejs + - pagelist + - fastwiki + - edittable + - dw2pdf + - bookcreator + - tag + - discussion + - dropfiles + - color + - nspages + - sortablejs ``` (2) `dokuwiki_plugins_remove`: The default list of plugins to remove is: ```Yaml dokuwiki_plugins_remove: - - name: authad - - name: authldap - - name: authmysql - - name: authpdo - - name: authpgsql - - name: info - - name: popularity + - authad + - authldap + - authmysql + - authpdo + - authpgsql + - info + - popularity ``` (3) `dokuwiki_templates`: A list of templates to install @@ -166,11 +165,11 @@ This will result in adding the user admin to Dokuwiki, with the bcrypted passwor (3) `dokuwiki_opt_license`: The options for this are: - cc-zero - [CC0 1.0 Universal](http://creativecommons.org/publicdomain/zero/1.0/) - publicdomain - [Public Domain](http://creativecommons.org/licenses/publicdomain/) -- cc-by - [CC Attribution 4.0](International http://creativecommons.org/licenses/by/4.0/) -- cc-by-sa - [CC Attribution-Share Alike 4.0](International http://creativecommons.org/licenses/by-sa/4.0/) +- cc-by - [CC Attribution 4.0 International](http://creativecommons.org/licenses/by/4.0/) +- cc-by-sa - [CC Attribution-Share Alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/) - gnufdl - [GNU Free Documentation License 1.3](http://www.gnu.org/licenses/fdl-1.3.html) -- cc-by-nc - [CC Attribution-Noncommercial 4.0](International http://creativecommons.org/licenses/by-nc/4.0/) -- cc-by-nc-sa - [CC Attribution-Noncommercial-Share Alike 4.0](International http://creativecommons.org/licenses/by-nc-sa/4.0/) +- cc-by-nc - [CC Attribution-Noncommercial 4.0International](http://creativecommons.org/licenses/by-nc/4.0/) +- cc-by-nc-sa - [CC Attribution-Noncommercial-Share Alike 4.0 International](http://creativecommons.org/licenses/by-nc-sa/4.0/) - 0 - Do not show any license information diff --git a/defaults/main.yml b/defaults/main.yml index 9a99556..f7f655f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,36 +20,6 @@ dokuwiki_server_name: "localhost" dokuwiki_base: /var/www/dokuwiki dokuwiki_savedir: /var/www/dokuwiki/data -# dokuwiki_plugins: -# - name: pagelist -# src: https://github.com/dokufreaks/plugin-pagelist/tarball/master -# # Lists pages in a nice looking table or unordered list. -# - name: fastwiki -# src: https://github.com/zioth/dokuwiki_fastwiki/archive/master.zip -# - name: edittable -# src: https://github.com/cosmocode/edittable/archive/master.zip -# - name: dw2pdf -# src: https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/tarball/master -# - name: bookcreator -# src: https://github.com/Klap-in/dokuwiki-plugin-bookcreator/archive/master.zip -# - name: tag -# src: https://github.com/dokufreaks/plugin-tag/tarball/master -# # Assign category tags to wiki pages -# - name: discussion -# src: https://github.com/dokufreaks/plugin-discussion/archive/master.zip -# - name: dropfiles -# src: https://github.com/cosmocode/dokuwiki-plugin-dropfiles/zipball/master -# # Drop files into the edit area to upload them -# - name: color -# src: https://github.com/hanche/dokuwiki_color_plugin/archive/2018-10-12.zip -# # Opportunity to write colored text in DokuWiki -# - name: nspages -# src: https://github.com/gturri/nspages/zipball/master -# # Present a table of contents of the pages of a selected namespace -# - name: sortablejs -# src: https://github.com/FyiurAmron/sortablejs/zipball/master -# #JavaScript for sortable tables - dokuwiki_plugins: - pagelist - fastwiki @@ -63,17 +33,14 @@ dokuwiki_plugins: - nspages - sortablejs - - dokuwiki_plugins_remove: - - name: authad - - name: authldap - - name: authmysql - - name: authpdo - - name: authpgsql - - name: info - - name: popularity - + - authad + - authldap + - authmysql + - authpdo + - authpgsql + - info + - popularity # Template parameters (will only be used when dokuwiki_provision is true) dokuwiki_acl_all: 0 diff --git a/tasks/main.yml b/tasks/main.yml index bed0ef4..e9436d3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -29,6 +29,22 @@ tags: - permission +- name: Download and install latest version of plugins via Dokuwiki's gittool + become: yes + shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install {{item}}" + with_items: "{{ dokuwiki_plugins|default([]) }}" + tags: + - plugins + - upgrade + +- name: Download and install latest version of templates via Dokuwiki's gittool + become: yes + shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install template:{{item.name}}" + with_items: "{{ dokuwiki_templates|default([]) }}" + tags: + - templates + - upgrade + - block: - name: Apply and deploy configuration templates template: @@ -68,21 +84,6 @@ - provision when: dokuwiki_provision -- name: Download and install latest version of plugins via Dokuwiki's gittool - become: yes - shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install {{item}}" - with_items: "{{ dokuwiki_plugins|default([]) }}" - tags: - - plugins - - upgrade - -- name: Download and install latest version of templates via Dokuwiki's gittool - become: yes - shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install template:{{item.name}}" - with_items: "{{ dokuwiki_templates|default([]) }}" - tags: - - templates - - upgrade # - name: Download and install latest version of plugins # become: yes diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 04b0ac6..bf0687e 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -1,4 +1,13 @@ --- +- name: Install Required Dependencies # must be done before php-fpm, due to mbstring + become: true + package: + name: "{{ item }}" + state: latest + install_recommends: false + with_items: "{{ dokuwiki_dependencies + dokuwiki_recommendations }}" +# + - name: Setup PHP-FPM block: - name: Install PHP-FPM @@ -43,14 +52,6 @@ when: dokuwiki_webserver == "nginx" # -- name: Install Required Dependencies - become: true - package: - name: "{{ item }}" - state: latest - install_recommends: false - with_items: "{{ dokuwiki_dependencies + dokuwiki_recommendations }}" -# - name: Make sure Dokuwiki base directory exists (workaround for Ansible bug) file: diff --git a/templates/plugins.local.php.j2 b/templates/plugins.local.php.j2 index dee2dbf..eef8dc8 100644 --- a/templates/plugins.local.php.j2 +++ b/templates/plugins.local.php.j2 @@ -4,7 +4,16 @@ * */ -$plugins['authad'] = 0; -$plugins['authldap'] = 0; -$plugins['authmysql'] = 0; -$plugins['authpgsql'] = 0; +# Disabled plugins +{% if dokuwiki_plugins_remove is defined %} +{% for plugin_name in dokuwiki_plugins_remove %} +$plugins['{{ plugin_name }}'] = 0; +{% endfor %} +{% endif %} + +# Enabled plugins +{% if dokuwiki_plugins is defined %} +{% for plugin_name in dokuwiki_plugins %} +$plugins['{{ plugin_name }}'] = 1; +{% endfor %} +{% endif %} From f47aa404868412a14f1ca07dd5da855a9047de26 Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Wed, 21 Aug 2019 16:07:27 +0100 Subject: [PATCH 8/9] local.php settings were moved to local.protected.php. This limits unwanted tampering via web interface. --- README.md | 8 ++++---- tasks/main.yml | 4 ++-- templates/{local.php.j2 => local.protected.php.j2} | 0 3 files changed, 6 insertions(+), 6 deletions(-) rename templates/{local.php.j2 => local.protected.php.j2} (100%) diff --git a/README.md b/README.md index 7742eba..88a1c8b 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ The following configuration files, located at `conf/*`, are templated: | :--- | :--- | | `acl.auth.php.j2` | Dokuwiki ACL Config file | | `cleanup.sh.j2` | Cron job to cleanup DokuWiki installations | -| `local.php.j2` | Dokuwiki's Main Configuration File - Local Settings | +| `local.protected.php.j2` | Dokuwiki's Main Configuration File - Local Settings, protected | | `php-fpm.www.conf.j2` | PHP FPM config file - altered to make this role php version agnostic | | `plugins.local.php.j2` | Local plugin enable/disable settings - recommended to be used with `dokuwiki_plugins_removed` | | `users.auth.php.j2` | If dokuwiki_users is defined, this file is provisioned with those local users | @@ -123,20 +123,20 @@ The following variables will be used in the configuration templates, and therefo | `dokuwiki_acl_all` | The ACL bits for the default (@ALL) group. By default, only logged on users are allowed access (0). | | `dokuwiki_acl_user` | The ACL bits for the user (@user) group. By default, users have upload, create, edit, and read permissions (8). | | `dokuwiki_disableactions` | Which actions to disable. By default, user auto registering is disabled. | -| `dokuwiki_local` (1) | A list of name / value configuration pairs to be added to the `local.php` configuration file. | +| `dokuwiki_local` (1) | A list of name / value configuration pairs to be added to the `local.protected.php` configuration file. | | `dokuwiki_users ` (2) | A list of users | | `dokuwiki_opt_license` (3) | The content license to use. `dokuwiki_opt_license: "0"` | -(1) `dokuwiki_local`: You can add additional parameters to the `local.php` configuration file, as seen here: +(1) `dokuwiki_local`: You can add additional parameters to the `local.protected.php` configuration file, as seen here: ```Yaml dokuwiki_local: - name: "['passcrypt']" value: 'bcrypt' ``` -This will result in adding the following string to `/conf/local.php`: +This will result in adding the following string to `/conf/local.protected.php`: ```Yaml $conf['passcrypt'] = 'bcrypt'; ``` diff --git a/tasks/main.yml b/tasks/main.yml index e9436d3..cb9a32e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -56,8 +56,8 @@ with_items: - src: acl.auth.php.j2 dest: acl.auth.php - - src: local.php.j2 - dest: local.php + - src: local.protected.php.j2 + dest: local.protected.php - src: plugins.local.php.j2 dest: plugins.local.php - src: users.auth.php.j2 diff --git a/templates/local.php.j2 b/templates/local.protected.php.j2 similarity index 100% rename from templates/local.php.j2 rename to templates/local.protected.php.j2 From 1fd065068be79659ebcdf4a93dee8947e43a0c0a Mon Sep 17 00:00:00 2001 From: "bruno.cacheira" Date: Thu, 22 Aug 2019 11:31:13 +0100 Subject: [PATCH 9/9] File and variable cleanup. Updated the README with a correct example and finished documenting all options. --- README.md | 40 +++++++++++++------------- tasks/main.yml | 64 +++++------------------------------------- tasks/setup-Debian.yml | 1 - 3 files changed, 26 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 88a1c8b..6559915 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ All other available variables are listed below, along with default values. The d | `dokuwiki_base` | Dokuwiki base directory. `dokuwiki_base: /var/www/dokuwiki` | | `dokuwiki_savedir` | Dokuwiki data directory. `dokuwiki_savedir: /var/www/dokuwiki/data` | | `dokuwiki_version` | Version to install. `dokuwiki_version: stable` | -| `dokuwiki_configure_apache2` | When true, will deploy an Apache configuration (`dokuwiki.conf.j2`) to Apache, and enable the site. `dokuwiki_configure_apache2: false`. | -| `dokuwiki_name` | The 'internal' name of the dokuwiki, which is e.g. used for Apache logfiles and the cleanup cronjob. (when `dokuwiki_configure_apache2` is true). This allows the Ansible role to be used for multiple Dokuwiki sites on the same server. Default: `dokuwiki_name: dokuwiki` | +| `dokuwiki_webserver` | When defined, will deploy an Nginx or Apache configuration (`apache.dokuwiki.conf.j2` or `nginx.dokuwiki.conf.j2`), and enable the site. `dokuwiki_webserver: nginx`. | +| `dokuwiki_name` | The 'internal' name of the dokuwiki, which is e.g. used for Nginx or Apache logfiles and the cleanup cronjob. (when `dokuwiki_webserver` is defined). This allows the Ansible role to be used for multiple Dokuwiki sites on the same server. Default: `dokuwiki_name: dokuwiki` | | `dokuwiki_base` | The local path where Dokuwiki will be installed. `dokuwiki_base: /var/www/html` | | `dokuwiki_user` | The user owning the Dokuwiki files. `dokuwiki_user: root` | | `dokuwiki_group` | The group owning the Dokuwiki files. `dokuwiki_group: www-data` | @@ -84,11 +84,9 @@ dokuwiki_plugins_remove: (3) `dokuwiki_templates`: A list of templates to install ```Yaml dokuwiki_templates: - - name: bootstrap3 + - bootstrap3 ``` - - (4) `dokuwiki_provision`: If not specified or false, Dokuwiki will be unprovisioned, a default installation. See below in the provisioning chapter which variables can be used in the configuration templates. Note that when this variable is true, it will @@ -119,7 +117,10 @@ The following variables will be used in the configuration templates, and therefo | Template | Comments | | :--- | :--- | -| `dokuwiki_title` | The Dokuwiki title | +| `dokuwiki_title` | The Dokuwiki title. `dokuwiki_title: "Default Dokuwiki site"` | +| `dokuwiki_opt_lang` | Dokuwiki's language option. `dokuwiki_opt_lang: "en"` | +| `dokuwiki_opt_policy` | Dokuwiki's policy. 0 - Open Wiki (read, write, upload for everyone); 1 - Public Wiki (read for everyone, write and upload for registered users); 2 - Closed Wiki (read, write, upload for registered users only). `dokuwiki_opt_policy: "0"` | +| `dokuwiki_opt_acl` | Dokuwiki ACL enable. `dokuwiki_opt_acl: "1"` | | `dokuwiki_acl_all` | The ACL bits for the default (@ALL) group. By default, only logged on users are allowed access (0). | | `dokuwiki_acl_user` | The ACL bits for the user (@user) group. By default, users have upload, create, edit, and read permissions (8). | | `dokuwiki_disableactions` | Which actions to disable. By default, user auto registering is disabled. | @@ -190,26 +191,23 @@ Example Playbook - role: PeterMosmans.dokuwiki vars: dokuwiki_base: /var/www/html - dokuwiki_configure_apache2: true + dokuwiki_webserver: nginx dokuwiki_plugins: - - name: tag - src: https://github.com/dokufreaks/plugin-tag/tarball/master - - name: pagelist - src: https://github.com/dokufreaks/plugin-pagelist/tarball/master + - tag + - pagelist dokuwiki_plugins_remove: - - name: authad - - name: authldap - - name: authmysql - - name: authpdo - - name: authpgsql - - name: info - - name: popularity + - authad + - authldap + - authmysql + - authpdo + - authpgsql + - info + - popularity dokuwiki_preconfigure: true dokuwiki_savedir: /var/www/html/data dokuwiki_template: bootstrap3 dokuwiki_templates: - - name: bootstrap3 - src: https://github.com/LotarProject/dokuwiki-template-bootstrap3/tarball/master + - bootstrap3 dokuwiki_users: - login: admin hash: "$2y$05$Nr3wFqH54gcdhxPK9easseLSVwLAnLTD2flYmQbAbCVIiiTU4mCjS" @@ -221,7 +219,7 @@ Example Playbook This example will install Dokuwiki to `/var/www/html`, and use `/var/www/html/data` as data directory. It will install the plugins `tag` and `pagelist`, and remove the plugins `authad`, `authldap`, `authmysql`, `authpdo`, `authpgsql`, `info` and `popularity`. It will install and use the `bootstrap3` theme, and grant the user `admin` with the password `admin` access to the wiki. -Moreover, it will configure and enable the Apache site. +Moreover, it will configure and enable the Nginx site. License diff --git a/tasks/main.yml b/tasks/main.yml index cb9a32e..93dd46d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -39,7 +39,7 @@ - name: Download and install latest version of templates via Dokuwiki's gittool become: yes - shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install template:{{item.name}}" + shell: "/usr/bin/php {{ dokuwiki_base }}/bin/gittool.php install template:{{item}}" with_items: "{{ dokuwiki_templates|default([]) }}" tags: - templates @@ -84,56 +84,6 @@ - provision when: dokuwiki_provision - -# - name: Download and install latest version of plugins -# become: yes -# unarchive: -# src: "{{ item.src }}" -# dest: "{{ dokuwiki_base }}/lib/plugins/{{ item.name }}" -# remote_src: true -# extra_opts: ['--strip-components=1'] -# group: "{{ dokuwiki_group }}" -# owner: "{{ dokuwiki_user }}" -# #mode: "0770" -# with_items: "{{ dokuwiki_plugins|default([]) }}" -# tags: -# - plugins -# - upgrade - -# - name: Remove previous versions of templates -# file: -# path: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" -# state: absent -# with_items: "{{ dokuwiki_templates|default([]) }}" -# tags: -# - templates -# - upgrade - -# - name: Recreate directory for each template (workaround for Ansible bug) -# file: -# path: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" -# state: directory -# group: "{{ dokuwiki_group }}" -# owner: "{{ dokuwiki_user }}" -# with_items: "{{ dokuwiki_templates|default([]) }}" -# tags: -# - templates -# - upgrade - -# - name: Download and install latest version of templates -# unarchive: -# src: "{{ item.src }}" -# dest: "{{ dokuwiki_base }}/lib/tpl/{{ item.name }}" -# remote_src: true -# extra_opts: ['--strip-components=1'] -# group: "{{ dokuwiki_group }}" -# owner: "{{ dokuwiki_user }}" -# mode: "0770" -# with_items: "{{ dokuwiki_templates|default([]) }}" -# tags: -# - templates -# - upgrade - - name: Customize template using online files get_url: url: "{{ item.url }}" @@ -183,7 +133,7 @@ - permission - upgrade -- name: Configure nginx and deploy Dokuwiki +- name: Apply and deploy Nginx configuration for Dokuwiki block: - name: Ensure Nginx conf.d exists file: @@ -193,7 +143,7 @@ owner: root mode: "0770" - - name: Create dokuwiki nginx config file and restart Nginx + - name: Create dokuwiki config file and restart Nginx template: src: nginx.dokuwiki.conf.j2 dest: "/etc/nginx/conf.d/{{ dokuwiki_name }}.conf" @@ -204,8 +154,8 @@ - templates notify: - restart nginx - #when: dokuwiki_webserver is defined and dokuwiki_webserver == "nginx" - when: dokuwiki_webserver == "nginx" + when: dokuwiki_webserver is defined and dokuwiki_webserver == "nginx" + #when: dokuwiki_webserver == "nginx" - block: - name: Apply and deploy Apache configuration for Dokuwiki @@ -220,13 +170,13 @@ notify: - restart apache2 - - name: Enable the site + - name: Enable dokuwiki and restart Apache command: a2ensite {{ dokuwiki_name }}.conf notify: - restart apache2 - when: dokuwiki_configure_apache2 is defined and dokuwiki_configure_apache2 + when: dokuwiki_webserver is defined and dokuwiki_webserver == "apache" \ No newline at end of file diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index bf0687e..3abed9a 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -52,7 +52,6 @@ when: dokuwiki_webserver == "nginx" # - - name: Make sure Dokuwiki base directory exists (workaround for Ansible bug) file: path: "{{ dokuwiki_base }}"