You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

100 lines
2.5 KiB

---
# NOTE: https://wiki.alpinelinux.org/wiki/DokuWiki
- name: test if dokuwiki is already installed
find:
paths: "{{ doku_dir }}"
pattern: README
register: check_installed
- set_fact:
install_dokuwiki: "{{ check_installed.matched == 0 }}"
- name: install block
when: install_dokuwiki
vars: {}
block:
- name: add dokuwiki deny rules to lighttpd.conf
blockinfile:
path: /etc/lighttpd/lighttpd.conf
block: |
$HTTP["url"] =~ "^/dokuwiki/(data|conf|bin|inc|vendor)/+." {
url.access-deny = ("")
}
- name: restart lighttpd
service:
name: lighttpd
enabled: yes
state: restarted
- name: download dokuwiki stable
get_url:
url: "{{ doku_url }}"
dest: "{{ doku_tar }}"
- name: make directory for dokiwiki in docroot
file:
path: "{{ doku_dir }}"
state: directory
owner: "{{ lighttpd_user }}"
group: "{{ lighttpd_group }}"
- name: unarchive downloaded file
unarchive:
remote_src: yes
src: "{{ doku_tar }}"
dest: /tmp
owner: "{{ lighttpd_user }}"
group: "{{ lighttpd_group }}"
- name: find doku temporary directory
find:
paths: /tmp/
file_type: directory
pattern: "dokuwiki-20*"
use_regex: true
register: doku_tmp_dir
- name: copy dokuwiki files to webroot
copy:
remote_src: yes
src: "{{ doku_tmp_dir.files[0].path }}/"
dest: "{{ doku_dir }}"
owner: "{{ lighttpd_user }}"
group: "{{ lighttpd_group }}"
- name: remove archive
file:
path: "{{ doku_tar }}"
state: absent
- name: remove temporary files
file:
path: "{{ doku_tmp_dir.files[0].path }}"
state: absent
##
## install backup data
##
- name: test for backup guard
find:
path: "{{ doku_dir }}"
pattern: "{{ backup_guard }}"
register: backup_guard_present
- name: extract backup archive
unarchive:
src: "{{ doku_backup_archive }}"
dest: "{{ doku_dir }}"
owner: "{{ lighttpd_user }}"
group: "{{ lighttpd_group }}"
when: use_backup and backup_guard_present.matched == 0
- name: add guard file to let ansible know backup is completed
file:
path: "{{ doku_dir }}/{{ backup_guard }}"
state: touch
when: use_backup and backup_guard_present.matched == 0