Michael Grote
d3a9241d12
Reviewed-on: #602 Co-authored-by: Michael Grote <michael.grote@posteo.de> Co-committed-by: Michael Grote <michael.grote@posteo.de>
73 lines
2.3 KiB
YAML
73 lines
2.3 KiB
YAML
---
|
|
- name: create dokuwiki install path
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ dokuwiki_install_path }}"
|
|
state: directory
|
|
owner: "{{ dokuwiki_user }}"
|
|
group: "{{ dokuwiki_group }}"
|
|
mode: "0744"
|
|
|
|
- name: check if dokuwiki is installed
|
|
become: true
|
|
ansible.builtin.stat:
|
|
path: /var/www/dokuwiki/VERSION
|
|
register: dokuwiki_install_status
|
|
|
|
- name: check if desired version is installed
|
|
become: true
|
|
ignore_errors: true
|
|
ansible.builtin.lineinfile:
|
|
path: /var/www/dokuwiki/VERSION
|
|
line: "{{ dokuwiki_version_name }}"
|
|
state: present
|
|
check_mode: true
|
|
register: dokuwiki_desired_version
|
|
when:
|
|
- dokuwiki_install_status.stat.exists
|
|
# falls Dokuwiki schon installiert ist existiert var/www/dokuwiki/VERSION mit
|
|
# dem Inhalt der Version: z.B. 2020-07-29 "Hogfather"
|
|
# when die Version die selbe wie in der Variable ist
|
|
# ist der status ok, ist die Version unterschiedlich ist der status changed, die Datei
|
|
# selber wird aber nicht geändert weil check_mode gleich yes ist
|
|
# das Ergebnis wird in der Variable dokuwiki_desired_version gespeichert
|
|
# https://raymii.org/s/tutorials/Ansible_-_Only-do-something-if-another-action-changed.html
|
|
|
|
- name: download latest dokuwiki archive & unarchive to {{ dokuwiki_install_path }}
|
|
become: true
|
|
ansible.builtin.unarchive:
|
|
src: "{{ dokuwiki_download_url }}"
|
|
dest: "{{ dokuwiki_install_path }}"
|
|
remote_src: true
|
|
extra_opts: [--strip-components=1] # entfernt die erste Ebene des Archives
|
|
owner: "{{ dokuwiki_user }}"
|
|
mode: "0744"
|
|
when:
|
|
- (dokuwiki_desired_version.changed) or
|
|
(not dokuwiki_install_status.stat.exists)
|
|
# Dise Variable wird hier abgefragt, so wird das Paket nur heruntergeladen wenn die
|
|
# Version Unterschiedlich ist
|
|
|
|
- name: Remove default plugins
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: '{{ dokuwiki_install_path }}/lib/plugins/{{ item }}'
|
|
state: absent
|
|
with_items:
|
|
- authpdo
|
|
- authmysql
|
|
- authpgsql
|
|
- authad
|
|
|
|
- name: Change file ownership, group and permissions
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ dokuwiki_install_path }}"
|
|
owner: "{{ dokuwiki_user }}"
|
|
group: "{{ dokuwiki_group }}"
|
|
mode: "0744"
|
|
|
|
- name: remove installer
|
|
ansible.builtin.file:
|
|
path: "{{ dokuwiki_install_path }}/install.php"
|
|
state: absent
|