Files
lsa.wikijs/readme.md
2026-03-14 17:45:00 +01:00

170 lines
4.9 KiB
Markdown

Wiki.js Ansible Role
====================
Ansible role to install and configure [Wiki.js](https://wiki.js.org/) - a modern, lightweight and powerful wiki platform.
This role supports two installation methods:
- **Docker** - Deploy Wiki.js using Docker Compose (default)
- **Native** - Install Wiki.js directly on the host system with systemd
Requirements
------------
- Ansible 2.9+
- For Docker deployment: Docker and Docker Compose installed on the target host
- For native deployment: Node.js installed (via NVM recommended)
Role Variables
--------------
### Installation Method
| Variable | Default | Description |
|----------|---------|-------------|
| `wikijs` | `true` | Enable/disable the role |
| `wikijs_docker_deploy` | `true` | Use Docker deployment |
| `wikijs_docker_compose` | `true` | Use Docker Compose for deployment |
### Docker Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `wikijs_docker_image_default` | `ghcr.io/requarks/wiki:latest` | Docker image to use |
| `wikijs_docker_path_default` | `/srv/wikijs` | Default path for Docker deployment |
### Docker Database Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `wikijs_docker_db_enabled` | `false` | Enable database container |
| `wikijs_docker_db_type` | `postgres` | Database type: `postgres` or `mariadb` |
| `wikijs_docker_db_name` | `wikijs-db` | Database container name |
| `wikijs_docker_db_user` | `wikijs` | Database username |
| `wikijs_docker_db_pwd` | `wikijs_password` | Database password |
| `wikijs_docker_db_name_default` | `wikijs` | Database name |
| `wikijs_docker_db_root_pwd` | `root_password` | Root password (MariaDB only) |
| `wikijs_docker_db_path` | `/srv/wikijs/db/data` | Database data volume path |
### Native Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `wikijs_path_default` | `/srv/wikijs` | Default installation path for native deployment |
| `wikijs_nvm_path` | `/root/.nvm/versions/node/` | Path to NVM Node.js installation |
| `wikijs_nvm_ver` | `22.11` | Node.js version to use |
| `wikijs_nvm_exec` | `/bin/node server` | Node.js executable command |
### Site Configuration (`wikijs_sites`)
| Variable | Default | Description |
|----------|---------|-------------|
| `name` | `default` | Site identifier/name |
| `path` | `/srv/wikijs` | Installation path |
| `port` | `3000` | Port Wiki.js should listen on |
| `db.type` | `postgres` | Database type (postgres, mysql, mariadb, mssql, sqlite) |
| `db.host` | `localhost` | Database host |
| `db.port` | `5432` | Database port |
| `db.user` | `wikijs` | Database username |
| `db.pass` | `wikijs` | Database password |
| `db.name` | `wikijs` | Database name |
| `db.ssl` | `false` | Enable SSL for database connection |
| `log.level` | `info` | Log level (error, warn, info, verbose, debug, silly) |
| `log.format` | `default` | Log format (default, json) |
| `offline` | `false` | Enable offline mode |
| `ha` | `false` | Enable high-availability mode |
| `datapath` | `./data` | Data path for cache and uploads |
| `bodyparserlimit` | `5mb` | Maximum API request body size |
Supported Database Engines:
- **postgres** = PostgreSQL 9.5 or later
- **mysql** = MySQL 8.0 or later (5.7.8 partially supported)
- **mariadb** = MariaDB 10.2.7 or later
- **mssql** = MS SQL Server 2012 or later
- **sqlite** = SQLite 3.9 or later
Dependencies
------------
None (Docker role may be required if using Docker deployment)
Example Playbook
----------------
### Docker Deployment
```yaml
- hosts: servers
vars:
wikijs_docker_deploy: true
wikijs_sites:
- name: "wiki1.example.com"
path: "/srv/wikijs/example"
ports:
- "3050:3000"
db:
type: "mariadb"
host: "localhost"
port: "3306"
user: "wikijs"
pwd: "SECRETSECRETSECRET"
name: "wikijs1"
- name: "wiki2.example.com"
db:
name: "wikijs2"
pwd: "SECRETSECRETSECRET"
roles:
- lsa.wikijs
```
### Docker Deployment with Database Container
```yaml
- hosts: servers
vars:
wikijs_docker_deploy: true
wikijs_docker_db_enabled: true
wikijs_docker_db_type: "postgres" # or "mariadb"
wikijs_docker_db_pwd: "your_secure_password"
wikijs_sites:
- name: "wiki.example.com"
db:
pwd: "your_secure_password"
roles:
- lsa.wikijs
```
### Native Deployment
```yaml
- hosts: servers
vars:
wikijs_docker_deploy: false
wikijs_sites:
- name: "wiki1.example.com"
path: "/srv/wikijs/example"
port: "3050"
db:
type: "mariadb"
host: "localhost"
port: "3306"
user: "wikijs"
pwd: "SECRETSECRETSECRET"
name: "wikijs1"
- name: "wiki2.example.com"
db:
name: "wikijs"
pwd: "SECRETSECRETSECRET"
roles:
- lsa.wikijs
```
License
-------
BSD
Author Information
------------------
LSA