servers/roles/dokuwiki/tasks/main.yml

70 lines
1.6 KiB
YAML
Raw Normal View History

- name: Set dokuwiki version
set_fact:
2024-02-20 15:01:51 +00:00
dokuwiki_version: 2024-02-06a
- name: Enable community package repo
lineinfile:
path: /etc/apk/repositories
regexp: '^# *(http.*/v[^/]*/community)'
line: '\1'
backrefs: yes
register: result
- name: Update package cache
package:
update_cache: true
when: result.changed
- name: Set up nginx
import_tasks: nginx.yml
- name: Set up PHP
import_tasks: php.yml
- name: Install packages
package:
name: php-openssl,php-session,php-xml
- name: Get current dokuwiki version if any
lineinfile:
path: /srv/http/doku.fri.uni-lj.si/VERSION
search_string: '{{ dokuwiki_version }}'
state: absent
check_mode: true
changed_when: false
register: current_version
- name: Install or upgrade dokuwiki
when: 'current_version.found|default(0) == 0'
block:
- name: Download dokuwiki tarball
get_url:
url: 'https://download.dokuwiki.org/src/dokuwiki/dokuwiki-{{ dokuwiki_version }}.tgz'
dest: /var/tmp/
- name: Unpack tarball
command: 'tar xvf dokuwiki-{{ dokuwiki_version }}.tgz'
args:
chdir: /var/tmp
- name: Copy dokuwiki files
copy:
dest: /srv/http/doku.fri.uni-lj.si/
src: '/var/tmp/dokuwiki-{{ dokuwiki_version }}/'
remote_src: true
owner: nginx
group: nginx
- name: Copy user style overrides
copy:
dest: /srv/http/doku.fri.uni-lj.si/conf/
src: userstyle.css
owner: nginx
group: nginx
- name: Create nginx site
template:
dest: /etc/nginx/http.d/doku.fri.uni-lj.si.conf
src: doku.fri.uni-lj.si.conf.j2
notify: reload nginx