PeterMosmans.dokuwiki
Ansible 角色:Dokuwiki
这个角色在服务器上安装、配置、加固和/或升级 Dokuwiki。 主要关注点是以可重复且安全的方式提供 Dokuwiki 实例。它不会自行安装 web 服务器,但可以添加并启用 Apache 配置文件(该配置文件作为模板包含在角色中)。
要求
需要一个安装了 PHP 的 web 服务器,例如使用 PeterMosmans.apache2。
角色变量
可用变量列在下面,并附有默认值。默认值在 default/main.yml
中指定。
dokuwiki_configure_apache2:当为真时,将部署 Apache 配置(dokuwiki.conf.j2
)到 Apache,并启用该站点。默认情况下,该变量未定义(为假)。
dokuwiki_name:Dokuwiki 的“内部”名称,例如用于 Apache 日志文件和清理的定时任务(当 dokuwiki_configure_apache2
为真时)。这允许在同一服务器上使用 Ansible 角色配置多个 Dokuwiki 站点。默认:
dokuwiki_name: dokuwiki
dokuwiki_source:可以找到(最新)版本的 Dokuwiki 的 URL。默认使用官方 Dokuwiki 源。
dokuwiki_source: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
dokuwiki_base:Dokuwiki 将被安装的本地路径。
dokuwiki_base: /var/www/html
dokuwiki_group:Dokuwiki 文件的所属组。
dokuwiki_group: www-data
dokuwiki_plugins:要自动安装的插件名称/源对的列表。源需要指向 tar 或 .tgz 源(例如)。示例:
- name: pagelist
src: https://github.com/dokufreaks/plugin-pagelist/tarball/master
dokuwiki_plugins_remove:安装或升级时要自动移除的插件列表。默认:
dokuwiki_plugins_remove:
- name: authad
- name: authldap
- name: authmysql
- name: authpdo
- name: authpgsql
- name: info
- name: popularity
dokuwiki_provision:为真时,应用配置模板以提供 Dokuwiki。如果未指定或为假,Dokuwiki 将被重置为默认安装。请参见下面的提供章节,了解可以在配置模板中使用的变量。注意,当该变量为真时,它将(重新)模板化并覆盖当前的 Dokuwiki 配置。
以下配置文件是模板化的:
/conf/acl.auth.php
/conf/local.php
/conf/plugins.local.php
/conf/users.auth.php
示例:
dokuwiki_provision: true
dokuwiki_savedir:所有文件(内容)将被存储的目录。
dokuwiki_savedir: /var/www/html/data
dokuwiki_templates:要自动安装的模板名称/源对的列表。源需要指向 tar 或 .tgz 源(例如)。示例:
dokuwiki_templates:
- name: bootstrap3
src: https://github.com/LotarProject/dokuwiki-template-bootstrap3/tarball/master
dokuwiki_user:Dokuwiki 文件的所属用户。
dokuwiki_user: root
提供
以下变量将在配置模板中使用(local.php.j2
,users.auth.php.j2
),因此只有在 dokuwiki_provision
设置为 true
时才会应用。
dokuwiki_acl_all:默认(@ALL)组的 ACL 权限位。默认情况下,只有登录用户被允许访问(0)。
dokuwiki_acl_user:用户(@user)组的 ACL 权限位。默认情况下,用户具有上传、创建、编辑和读取权限(8)。
dokuwiki_disableactions:要禁用的操作。默认情况下,注册被禁用。
dokuwiki_title:Dokuwiki 标题。
dokuwiki_local:要添加到 local.php
配置文件的名称/值对配置列表。示例:
dokuwiki_local:
- name: "['passcrypt']"
value: 'bcrypt'
这将导致在 /conf/local.php
中添加以下字符串:
$conf['mytemplate'] = 'myvalue';
dokuwiki_users:用户列表,包含以下名称/值对:
- login: 登录名
- hash: 密码哈希
- name: 全名
- email: 电子邮件地址
- groups: 逗号分隔的组列表
示例:
dokuwiki_users:
- login: admin
hash: "$2y$05$Nr3wFqH54gcdhxPK9easseLSVwLAnLTD2flYmQbAbCVIiiTU4mCjS"
name: Administrator
email: admin@admin
groups: admin,user
这将导致将用户 admin 添加到 Dokuwiki,密码为 admin
的加密形式。
依赖
无。
示例剧本
- 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
该示例将 Dokuwiki 安装到 /var/www/html
,并使用 /var/www/html/data
作为数据目录。
它将安装插件 tag
和 pagelist
,并移除插件 authad
、authldap
、authmysql
、authpdo
、authpgsql
、info
和 popularity
。
它将安装并使用 bootstrap3
主题,并授予用户 admin
以 admin
为密码的访问权限。
此外,它还将配置并启用 Apache 网站。
许可证
GPLv3
作者信息
由 Peter Mosmans 创建。欢迎提出建议、反馈和拉取请求。
贡献者:@onny