- role: base
- role: acmetool/base
- role: nginx
- - role: dokuwiki
+ - role: web/dokuwiki
+++ /dev/null
----
-dokuwiki_templates: {}
-dokuwiki_plugins: {}
-
-## example, mind that only tar.gz archives are allowed here!
-## (dokuwiki_templates uses the same format)
-# dokuwiki_plugins:
-# pluginname:
-# url: https://example.com/dokuwiki-pluginname.tar.gz
-# sha256: 129192409230902134091230940230940932
-#
+++ /dev/null
----
-- name: install dokuwiki packages
- apt:
- name:
- - dokuwiki
- - php-fpm
- state: present
-
-- name: install nginx vhost config
- template:
- src: nginx.j2
- dest: "/etc/nginx/sites-available/{{ dokuwiki_urls[0] }}"
- notify: reload nginx
-
-- name: eanble nginx vhost config
- file:
- src: "../sites-available/{{ dokuwiki_urls[0] }}"
- dest: "/etc/nginx/sites-enabled/{{ dokuwiki_urls[0] }}"
- state: link
- notify: reload nginx
-
-- name: check if acme certs already exists
- stat:
- path: "/var/lib/acme/live/{{ item }}"
- with_items: "{{ dokuwiki_urls }}"
- register: acme_cert_stat
-
-- name: set acmecert_missing_hostnames variable
- set_fact:
- acmecert_missing_hostnames: "{{ acme_cert_stat.results | acme_cert_nonexistent(dokuwiki_urls) }}"
-
-- name: link nonexistent hostnames to self-signed interim cert
- when: acmecert_missing_hostnames | length > 0
- block:
- - name: get id of existing selfsigned interim certificate
- command: cat /var/lib/acme/.selfsigned-interim-cert
- changed_when: false
- check_mode: false
- register: selfsigned_interim_cert_id
-
- - name: set selfsigned_interim_cert_id variable
- set_fact:
- selfsigned_interim_cert_id: "{{ selfsigned_interim_cert_id.stdout }}"
-
- - name: link to snakeoil cert for nonexistent hostnames
- file:
- src: "../certs/{{ selfsigned_interim_cert_id }}"
- dest: "/var/lib/acme/live/{{ item }}"
- state: link
- with_items: "{{ acmecert_missing_hostnames }}"
-
-- name: enable vhost config using acme cert
- file:
- src: "../sites-available/{{ dokuwiki_urls[0] }}"
- dest: "/etc/nginx/sites-enabled/{{ dokuwiki_urls[0] }}"
- state: link
-
-- name: make sure nginx config has been loaded
- meta: flush_handlers
-
-- name: get certificate using acmetool
- import_role:
- name: acmetool/cert
- vars:
- acmetool_cert_name: "{{ dokuwiki_urls[0] }}"
- acmetool_cert_hostnames: "{{ dokuwiki_urls }}"
-
-- name: install dokuwiki plugins
- import_tasks: plugins.yml
-
-- name: install dokuwiki templates
- import_tasks: templates.yml
+++ /dev/null
----
-## TODO: remove superflous plugins
-
-- name: create plugin directories
- with_dict: "{{ dokuwiki_plugins }}"
- loop_control:
- label: "{{ item.key }}"
- file:
- path: "/var/lib/dokuwiki/.ansible-managed-plugins/{{ item.key }}/extracted"
- state: directory
-
-- name: download dokuwiki plugins
- with_dict: "{{ dokuwiki_plugins }}"
- loop_control:
- label: "{{ item.key }}"
- get_url:
- url: "{{ item.value.url }}"
- dest: "/var/lib/dokuwiki/.ansible-managed-plugins/{{ item.key }}"
- checksum: "sha256:{{ item.value.sha256 }}"
- register: dokuwiki_plugins_downloaded
-
-## TODO: fix update!!!
-- name: extract dokuwiki plugins
- with_list: "{{ dokuwiki_plugins_downloaded.results }}"
- loop_control:
- label: "{{ item.item.key }}"
- unarchive:
- remote_src: yes
- src: "{{ item.dest }}"
- dest: "{{ item.dest | dirname }}/extracted"
- extra_opts:
- - '--strip-components=1'
-
-- name: activate dokuwiki plugins
- with_dict: "{{ dokuwiki_plugins }}"
- loop_control:
- label: "{{ item.key }}"
- file:
- state: link
- src: "/var/lib/dokuwiki/.ansible-managed-plugins/{{ item.key }}/extracted"
- dest: "/var/lib/dokuwiki/lib/plugins/{{ item.key }}"
+++ /dev/null
----
-## TODO: remove superflous templates
-
-- name: create plugin directories
- with_dict: "{{ dokuwiki_templates }}"
- loop_control:
- label: "{{ item.key }}"
- file:
- path: "/var/lib/dokuwiki/.ansible-managed-templates/{{ item.key }}/extracted"
- state: directory
-
-- name: download dokuwiki templates
- with_dict: "{{ dokuwiki_templates }}"
- loop_control:
- label: "{{ item.key }}"
- get_url:
- url: "{{ item.value.url }}"
- dest: "/var/lib/dokuwiki/.ansible-managed-templates/{{ item.key }}"
- checksum: "sha256:{{ item.value.sha256 }}"
- register: dokuwiki_templates_downloaded
-
-## TODO: fix update!!!
-- name: extract dokuwiki templates
- with_list: "{{ dokuwiki_templates_downloaded.results }}"
- loop_control:
- label: "{{ item.item.key }}"
- unarchive:
- remote_src: yes
- src: "{{ item.dest }}"
- dest: "{{ item.dest | dirname }}/extracted"
- extra_opts:
- - '--strip-components=1'
-
-- name: activate dokuwiki templates
- with_dict: "{{ dokuwiki_templates }}"
- loop_control:
- label: "{{ item.key }}"
- file:
- state: link
- src: "/var/lib/dokuwiki/.ansible-managed-templates/{{ item.key }}/extracted"
- dest: "/var/lib/dokuwiki/lib/tpl/{{ item.key }}"
+++ /dev/null
-server {
- listen [::]:443 ssl;
- listen 443 ssl;
-
- server_name {{ dokuwiki_urls | join(' ') }};
-
- client_max_body_size 4M;
- client_body_buffer_size 128k;
-
- root /usr/share/dokuwiki;
- index doku.php;
-
- #Remember to comment the below out when you're installing, and uncomment it when done.
- location ~ /(conf/|bin/|inc/|install.php) {
- deny all;
- }
-
- #Support for X-Accel-Redirect
- location ~ ^/data/ {
- internal;
- }
-
- location ~ ^/lib.*\.(js|css|gif|png|ico|jpg|jpeg)$ {
- expires 365d;
- }
-
- location / {
- try_files $uri $uri/ @dokuwiki;
- }
-
- location @dokuwiki {
- # rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
- 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&$args last;
- }
-
- location ~ \.php$ {
- try_files $uri $uri/ /doku.php;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param REDIRECT_STATUS 200;
- fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
- }
-}
--- /dev/null
+---
+dokuwiki_templates: {}
+dokuwiki_plugins: {}
+
+## example, mind that only tar.gz archives are allowed here!
+## (dokuwiki_templates uses the same format)
+# dokuwiki_plugins:
+# pluginname:
+# url: https://example.com/dokuwiki-pluginname.tar.gz
+# sha256: 129192409230902134091230940230940932
+#
--- /dev/null
+---
+- name: install dokuwiki packages
+ apt:
+ name:
+ - dokuwiki
+ - php-fpm
+ state: present
+
+- name: install nginx vhost config
+ template:
+ src: nginx.j2
+ dest: "/etc/nginx/sites-available/{{ dokuwiki_urls[0] }}"
+ notify: reload nginx
+
+- name: eanble nginx vhost config
+ file:
+ src: "../sites-available/{{ dokuwiki_urls[0] }}"
+ dest: "/etc/nginx/sites-enabled/{{ dokuwiki_urls[0] }}"
+ state: link
+ notify: reload nginx
+
+- name: check if acme certs already exists
+ stat:
+ path: "/var/lib/acme/live/{{ item }}"
+ with_items: "{{ dokuwiki_urls }}"
+ register: acme_cert_stat
+
+- name: set acmecert_missing_hostnames variable
+ set_fact:
+ acmecert_missing_hostnames: "{{ acme_cert_stat.results | acme_cert_nonexistent(dokuwiki_urls) }}"
+
+- name: link nonexistent hostnames to self-signed interim cert
+ when: acmecert_missing_hostnames | length > 0
+ block:
+ - name: get id of existing selfsigned interim certificate
+ command: cat /var/lib/acme/.selfsigned-interim-cert
+ changed_when: false
+ check_mode: false
+ register: selfsigned_interim_cert_id
+
+ - name: set selfsigned_interim_cert_id variable
+ set_fact:
+ selfsigned_interim_cert_id: "{{ selfsigned_interim_cert_id.stdout }}"
+
+ - name: link to snakeoil cert for nonexistent hostnames
+ file:
+ src: "../certs/{{ selfsigned_interim_cert_id }}"
+ dest: "/var/lib/acme/live/{{ item }}"
+ state: link
+ with_items: "{{ acmecert_missing_hostnames }}"
+
+- name: enable vhost config using acme cert
+ file:
+ src: "../sites-available/{{ dokuwiki_urls[0] }}"
+ dest: "/etc/nginx/sites-enabled/{{ dokuwiki_urls[0] }}"
+ state: link
+
+- name: make sure nginx config has been loaded
+ meta: flush_handlers
+
+- name: get certificate using acmetool
+ import_role:
+ name: acmetool/cert
+ vars:
+ acmetool_cert_name: "{{ dokuwiki_urls[0] }}"
+ acmetool_cert_hostnames: "{{ dokuwiki_urls }}"
+
+- name: install dokuwiki plugins
+ import_tasks: plugins.yml
+
+- name: install dokuwiki templates
+ import_tasks: templates.yml
--- /dev/null
+---
+## TODO: remove superflous plugins
+
+- name: create plugin directories
+ with_dict: "{{ dokuwiki_plugins }}"
+ loop_control:
+ label: "{{ item.key }}"
+ file:
+ path: "/var/lib/dokuwiki/.ansible-managed-plugins/{{ item.key }}/extracted"
+ state: directory
+
+- name: download dokuwiki plugins
+ with_dict: "{{ dokuwiki_plugins }}"
+ loop_control:
+ label: "{{ item.key }}"
+ get_url:
+ url: "{{ item.value.url }}"
+ dest: "/var/lib/dokuwiki/.ansible-managed-plugins/{{ item.key }}"
+ checksum: "sha256:{{ item.value.sha256 }}"
+ register: dokuwiki_plugins_downloaded
+
+## TODO: fix update!!!
+- name: extract dokuwiki plugins
+ with_list: "{{ dokuwiki_plugins_downloaded.results }}"
+ loop_control:
+ label: "{{ item.item.key }}"
+ unarchive:
+ remote_src: yes
+ src: "{{ item.dest }}"
+ dest: "{{ item.dest | dirname }}/extracted"
+ extra_opts:
+ - '--strip-components=1'
+
+- name: activate dokuwiki plugins
+ with_dict: "{{ dokuwiki_plugins }}"
+ loop_control:
+ label: "{{ item.key }}"
+ file:
+ state: link
+ src: "/var/lib/dokuwiki/.ansible-managed-plugins/{{ item.key }}/extracted"
+ dest: "/var/lib/dokuwiki/lib/plugins/{{ item.key }}"
--- /dev/null
+---
+## TODO: remove superflous templates
+
+- name: create plugin directories
+ with_dict: "{{ dokuwiki_templates }}"
+ loop_control:
+ label: "{{ item.key }}"
+ file:
+ path: "/var/lib/dokuwiki/.ansible-managed-templates/{{ item.key }}/extracted"
+ state: directory
+
+- name: download dokuwiki templates
+ with_dict: "{{ dokuwiki_templates }}"
+ loop_control:
+ label: "{{ item.key }}"
+ get_url:
+ url: "{{ item.value.url }}"
+ dest: "/var/lib/dokuwiki/.ansible-managed-templates/{{ item.key }}"
+ checksum: "sha256:{{ item.value.sha256 }}"
+ register: dokuwiki_templates_downloaded
+
+## TODO: fix update!!!
+- name: extract dokuwiki templates
+ with_list: "{{ dokuwiki_templates_downloaded.results }}"
+ loop_control:
+ label: "{{ item.item.key }}"
+ unarchive:
+ remote_src: yes
+ src: "{{ item.dest }}"
+ dest: "{{ item.dest | dirname }}/extracted"
+ extra_opts:
+ - '--strip-components=1'
+
+- name: activate dokuwiki templates
+ with_dict: "{{ dokuwiki_templates }}"
+ loop_control:
+ label: "{{ item.key }}"
+ file:
+ state: link
+ src: "/var/lib/dokuwiki/.ansible-managed-templates/{{ item.key }}/extracted"
+ dest: "/var/lib/dokuwiki/lib/tpl/{{ item.key }}"
--- /dev/null
+server {
+ listen [::]:443 ssl;
+ listen 443 ssl;
+
+ server_name {{ dokuwiki_urls | join(' ') }};
+
+ client_max_body_size 4M;
+ client_body_buffer_size 128k;
+
+ root /usr/share/dokuwiki;
+ index doku.php;
+
+ #Remember to comment the below out when you're installing, and uncomment it when done.
+ location ~ /(conf/|bin/|inc/|install.php) {
+ deny all;
+ }
+
+ #Support for X-Accel-Redirect
+ location ~ ^/data/ {
+ internal;
+ }
+
+ location ~ ^/lib.*\.(js|css|gif|png|ico|jpg|jpeg)$ {
+ expires 365d;
+ }
+
+ location / {
+ try_files $uri $uri/ @dokuwiki;
+ }
+
+ location @dokuwiki {
+ # rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
+ 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&$args last;
+ }
+
+ location ~ \.php$ {
+ try_files $uri $uri/ /doku.php;
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param REDIRECT_STATUS 200;
+ fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
+ }
+}