PeterMosmans.dokuwiki

Ansible Role: Dokuwiki

Build status for this role: Build Status

This role installs, sets up, secures, and updates Dokuwiki on a server. It focuses on consistently and securely setting up Dokuwiki. Note that it does not install a web server by itself but can configure an Apache web server if needed.

Requirements

You need a web server with PHP installed—such as PeterMosmans.apache2.

Role Variables

Here are the available settings with their default values listed in default/main.yml.

  • dokuwiki_configure_apache2: If true, it will set up an Apache configuration (dokuwiki.conf.j2) and enable the site. By default, this variable is not set (false).

  • dokuwiki_name: The name of your Dokuwiki, used in Apache logs and cleanup jobs (if dokuwiki_configure_apache2 is true). This allows multiple Dokuwiki sites on the same server. Default:

    dokuwiki_name: dokuwiki
    
  • dokuwiki_source: The URL for the latest Dokuwiki version. Default:

    dokuwiki_source: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
    
  • dokuwiki_base: The local path where Dokuwiki will be installed. Default:

    dokuwiki_base: /var/www/html
    
  • dokuwiki_group: The group that owns the Dokuwiki files. Default:

    dokuwiki_group: www-data
    
  • dokuwiki_plugins: A list of plugins to install automatically. You need to point to tar or .tgz sources. Example:

    - name: pagelist
      src: https://github.com/dokufreaks/plugin-pagelist/tarball/master
    
  • dokuwiki_plugins_remove: A list of plugins to remove during installation or upgrade. Default:

    dokuwiki_plugins_remove:
      - name: authad
      - name: authldap
      - name: authmysql
      - name: authpdo
      - name: authpgsql
      - name: info
      - name: popularity
    
  • dokuwiki_provision: If true, it applies configuration templates to Dokuwiki. If it's false or not specified, Dokuwiki will be set up without custom configurations. When this variable is true, it will also replace the existing Dokuwiki configuration. Config files that will be templated include:

    • /conf/acl.auth.php
    • /conf/local.php
    • /conf/plugins.local.php
    • /conf/users.auth.php

    Example:

    dokuwiki_provision: true
    
  • dokuwiki_savedir: The directory where all your Dokuwiki content will be stored. Default:

    dokuwiki_savedir: /var/www/html/data
    
  • dokuwiki_templates: A list of templates to install automatically. Example:

    dokuwiki_templates:
     - name: bootstrap3
       src: https://github.com/LotarProject/dokuwiki-template-bootstrap3/tarball/master
    
  • dokuwiki_user: The user who owns the Dokuwiki files. Default:

    dokuwiki_user: root
    

Provisioning

The following variables will be used in the configuration templates and will only take effect if dokuwiki_provision is set to true.

  • dokuwiki_acl_all: Access control settings for everyone. By default, only logged-in users can access (0).

  • dokuwiki_acl_user: Access control settings for regular users. By default, users can upload, create, edit, and read (8).

  • dokuwiki_disableactions: Actions to disable. By default, user registration is disabled.

  • dokuwiki_title: The title of your Dokuwiki.

  • dokuwiki_local: A list of custom settings to add to the local.php file. Example:

    dokuwiki_local:
      - name: "['passcrypt']"
        value: 'bcrypt'
    

    This will add:

    $conf['mytemplate'] = 'myvalue';
    
  • dokuwiki_users: A list of users with details, including:

    - login: login
    - hash: password hash
    - name: full name
    - email: email address
    - groups: comma separated list of groups
    

    Example:

    dokuwiki_users:
    - login: admin
      hash: "$2y$05$Nr3wFqH54gcdhxPK9easseLSVwLAnLTD2flYmQbAbCVIiiTU4mCjS"
      name: Administrator
      email: admin@admin
      groups: admin,user
    

    This will create an admin user in Dokuwiki with the encrypted password.

Dependencies

None.

Example Playbook

- hosts: all
  become: yes
  become_method: sudo
  roles:
  - role: PeterMosmans.dokuwiki
  vars:
    dokuwiki_base: /var/www/html
    dokuwiki_configure_apache2: true
    dokuwiki_plugins:
      - name: tag
        src: https://github.com/dokufreaks/plugin-tag/tarball/master
      - name: pagelist
        src: https://github.com/dokufreaks/plugin-pagelist/tarball/master
    dokuwiki_plugins_remove:
      - name: authad
      - name: authldap
      - name: authmysql
      - name: authpdo
      - name: authpgsql
      - name: info
      - name: 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
    dokuwiki_users:
      - login: admin
        hash: "$2y$05$Nr3wFqH54gcdhxPK9easseLSVwLAnLTD2flYmQbAbCVIiiTU4mCjS"
        name: Administrator
        email: admin@admin
        groups: admin,user

This example will install Dokuwiki in /var/www/html and will use /var/www/html/data for data storage. It will install the tag and pagelist plugins, and remove several unnecessary plugins. It also sets up the bootstrap3 theme and creates an admin user.

License

GPLv3

Author Information

Created by Peter Mosmans. Suggestions and contributions are always welcome.

Contributions by @onny

Informazioni sul progetto

Installs, configures and hardens Dokuwiki (including plugins and templates)

Installa
ansible-galaxy install PeterMosmans.dokuwiki
Licenza
gpl-3.0
Download
179
Proprietario
Lead pentester, security consultant, trainer