Rolle: Dokuwiki neu
This commit is contained in:
parent
95f260a24c
commit
2945fcb67b
11 changed files with 148 additions and 141 deletions
|
@ -4,9 +4,3 @@
|
|||
- { role: mgrote.dokuwiki, tags: "dokuwiki" }
|
||||
vars:
|
||||
dokuwiki_update: false # Muss für den ersten Lauf aktiviert sein!
|
||||
|
||||
# Aus Backup wiederherstellen
|
||||
# chmod 777 /var/www/dokuwiki
|
||||
# Daten reinkopieren
|
||||
# chmod 755 /var/www/dokuwiki
|
||||
# chown www-data:www-data /var/www/dokuwiki
|
||||
|
|
|
@ -2,35 +2,28 @@
|
|||
|
||||
### Beschreibung
|
||||
Installiert Dokuwiki (mit apache2 und php-fpm).
|
||||
Es werden keine Einstellungen gesetzt
|
||||
Es werden keine Einstellungen gesetzt.
|
||||
|
||||
### Funktioniert auf
|
||||
- [x] Ubuntu (>=18.04)
|
||||
|
||||
### Variablen + Defaults
|
||||
##### Pfad zu Dokuwiki
|
||||
dokuwiki_install_path: /var/www/dokuwiki
|
||||
##### Soll IMMER ein Update/Neuer Download durchgeführt werden
|
||||
- Muss für den ersten Lauf aktiviert sein!
|
||||
dokuwiki_update: true
|
||||
##### install.php behalten (für Ersteinrichtung)
|
||||
dokuwiki_install: false
|
||||
### Beispiel Playbook
|
||||
```yaml
|
||||
---
|
||||
- hosts: dokuwiki
|
||||
roles:
|
||||
- { role: mgrote.dokuwiki, tags: "dokuwiki" }
|
||||
```
|
||||
see [defaults](./defaults/main.yml)
|
||||
|
||||
### Daten...
|
||||
#### Backup einspielen
|
||||
1. aus Restic wiederherstellen
|
||||
2. in Archiv packen
|
||||
3. Inhalt nach /var/www/dokuwiki entpacken
|
||||
4. Rechte anpassen: chmod 755 /var/www/dokuwiki
|
||||
5. Besitzer anpassen: chown www-data:www-data /var/www/dokuwiki
|
||||
|
||||
### Einrichtung danach...
|
||||
#### entweder mit dem Assistenten einrichten
|
||||
--> http://dokuwiki-test.grote.lan/install.php
|
||||
#### oder die alten Dateien verwenden
|
||||
Nach dem ausführen des Playbooks
|
||||
alles in `/var/www/dokuwiki` löschen
|
||||
`rm -rf * /var/www/dokuwiki/`
|
||||
die alten Dateien nach "/var/www/dokuwiki" kopieren
|
||||
`mv /home/mg/dokuwiki /var/www/`
|
||||
die Dateirechte richtig setzen
|
||||
`chown -R www-data /var/www/dokuwiki/`
|
||||
#### Wechsel OS/Maschine
|
||||
##### auf altem PC
|
||||
1. tar -czf dw_backup.tar.gz /var/www/dokuwiki
|
||||
##### auf neuem PC
|
||||
1. Archiv in /home/mg/backup_<data>.tar.gz abspeichern
|
||||
2. Archiv in /var/www verschieben: mv /home/mg/backup_<data>.tar.gz /var/www
|
||||
3. entpacken: tar -xzf backup_<data>.tar.gz
|
||||
4. Rechte anpassen: chmod 755 /var/www/dokuwiki
|
||||
5. Besitzer anpassen: chown www-data:www-data /var/www/dokuwiki
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
---
|
||||
dokuwiki_install_path: /var/www/dokuwiki
|
||||
dokuwiki_update: false
|
||||
dokuwiki_install: false
|
||||
dokuwiki_install_path: /var/www/dokuwiki # wohin soll dokuwiki installiert werden
|
||||
dokuwiki_download_url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz # wo soll dokuwiki heruntergeladen werden
|
||||
dokuwiki_version_name: 2020-07-29 "Hogfather" # aus /var/www/dokuwiki/VERSION # welche Version, damit wird abgeglichen ob das Archiv heruntergeladen werden muss
|
||||
dokuwiki_user: www-data # dokuwiki nutzer
|
||||
dokuwiki_group: www-data #dokuwiki gruppe
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
galaxy_info:
|
||||
author: mgrote
|
||||
description: install_dokuwiki
|
||||
min_ansible_version: 2.0
|
||||
license: GPLv3
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- system
|
||||
- role: mgrote.postfix
|
||||
|
|
21
roles/mgrote.dokuwiki/tasks/apache2.yml
Normal file
21
roles/mgrote.dokuwiki/tasks/apache2.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
# aktiviert das module rewrite = a2enmod rewrite
|
||||
- name: activate a2enmod rewrite
|
||||
become: yes
|
||||
ansible.builtin.apache2_module:
|
||||
state: present
|
||||
name: rewrite
|
||||
|
||||
- name: copy default apache2.conf
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: "apache2.conf"
|
||||
dest: "/etc/apache2/apache2.conf"
|
||||
notify: restart_apache2
|
||||
|
||||
- name: copy 000-default.conf
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: "000-default.conf"
|
||||
dest: "/etc/apache2/sites-enabled/000-default.conf"
|
||||
notify: restart_apache2
|
72
roles/mgrote.dokuwiki/tasks/dokuwiki.yml
Normal file
72
roles/mgrote.dokuwiki/tasks/dokuwiki.yml
Normal file
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
- name: create dokuwiki install path
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
path: "{{ dokuwiki_install_path }}"
|
||||
state: directory
|
||||
owner: "{{ dokuwiki_user }}"
|
||||
group: "{{ dokuwiki_group }}"
|
||||
|
||||
- name: check if dokuwiki is installed
|
||||
become: yes
|
||||
stat:
|
||||
path: /var/www/dokuwiki/VERSION
|
||||
register: dokuwiki_install_status
|
||||
|
||||
- name: check if desired version is installed
|
||||
become: yes
|
||||
ignore_errors: yes
|
||||
lineinfile:
|
||||
path: /var/www/dokuwiki/VERSION
|
||||
line: "{{ dokuwiki_version_name }}"
|
||||
state: present
|
||||
check_mode: yes
|
||||
register: dokuwiki_desired_version
|
||||
when:
|
||||
- dokuwiki_install_status.stat.exists == true
|
||||
# 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: yes
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ dokuwiki_download_url }}"
|
||||
dest: "{{ dokuwiki_install_path }}"
|
||||
remote_src: yes
|
||||
extra_opts: [--strip-components=1] # entfernt die erste Ebene des Archives
|
||||
owner: "{{ dokuwiki_user }}"
|
||||
mode: 0744
|
||||
when:
|
||||
- (dokuwiki_desired_version.changed) or
|
||||
(dokuwiki_install_status.stat.exists == false)
|
||||
# Dise Variable wird hier abgefragt, so wird das Paket nur heruntergeladen wenn die
|
||||
# Version Unterschiedlich ist
|
||||
|
||||
- name: Remove default plugins
|
||||
become: yes
|
||||
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: yes
|
||||
ansible.builtin.file:
|
||||
path: "{{ dokuwiki_install_path }}"
|
||||
owner: "{{ dokuwiki_user }}"
|
||||
group: "{{ dokuwiki_group }}"
|
||||
mode: 0744
|
||||
|
||||
- name: remove installer
|
||||
file:
|
||||
path: "{{ dokuwiki_install_path }}/install.php"
|
||||
state: absent
|
13
roles/mgrote.dokuwiki/tasks/install.yml
Normal file
13
roles/mgrote.dokuwiki/tasks/install.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: install packages
|
||||
become: yes
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- php
|
||||
- php-mbstring
|
||||
- php-xml
|
||||
- apache2
|
||||
- libapache2-mod-php
|
||||
- php-xml
|
||||
- php-gd
|
||||
state: present
|
|
@ -1,91 +1,7 @@
|
|||
- name: install packages
|
||||
become: yes
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- php
|
||||
- php-mbstring
|
||||
- php-xml
|
||||
- apache2
|
||||
- libapache2-mod-php
|
||||
- php-xml
|
||||
- php-gd
|
||||
state: present
|
||||
|
||||
# aktiviert das module rewrite = a2enmod rewrite
|
||||
- name: activate a2enmod rewrite
|
||||
become: yes
|
||||
ansible.builtin.apache2_module:
|
||||
state: present
|
||||
name: rewrite
|
||||
|
||||
- name: Download latest dokuwiki
|
||||
become: yes
|
||||
ansible.builtin.get_url:
|
||||
url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
|
||||
dest: /tmp/dokuwiki-stable.tgz
|
||||
when: dokuwiki_update # noqa 601 # entspricht when: dokuwiki_update == true; noqa sorgt dafür dass das beispiel nicht "gemeldet" wird
|
||||
|
||||
- name: create dokuwiki install path
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
path: "{{ dokuwiki_install_path }}"
|
||||
state: directory
|
||||
owner: www-data
|
||||
group: www-data
|
||||
|
||||
- name: Unarchive dokuwiki-stable.tgz to {{ dokuwiki_install_path }}
|
||||
become: yes
|
||||
ansible.builtin.unarchive:
|
||||
src: /tmp/dokuwiki-stable.tgz
|
||||
dest: "{{ dokuwiki_install_path }}"
|
||||
owner: www-data
|
||||
remote_src: yes
|
||||
list_files: yes
|
||||
extra_opts: [--strip-components=1] # entfernt die erste Ebene des Archives
|
||||
when: dokuwiki_update
|
||||
|
||||
- name: Remove default plugins
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
path: '{{ dokuwiki_install_path }}/lib/plugins/{{ item }}'
|
||||
state: absent
|
||||
with_items:
|
||||
- authpdo
|
||||
- authmysql
|
||||
- authpgsql
|
||||
- authad
|
||||
when: dokuwiki_update
|
||||
|
||||
- name: Change file ownership, group and permissions
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
path: "{{ dokuwiki_install_path }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
|
||||
- name: copy apache2.conf
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: "apache2.conf"
|
||||
dest: "/etc/apache2/apache2.conf"
|
||||
notify: restart_apache2
|
||||
|
||||
- name: copy 000-default.conf
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: "000-default.conf"
|
||||
dest: "/etc/apache2/sites-enabled/000-default.conf"
|
||||
notify: restart_apache2
|
||||
|
||||
- name: remove tmp files
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
path: /tmp/dokuwiki-stable.tgz
|
||||
state: absent
|
||||
|
||||
- name: remove install.php
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
path: '{{ dokuwiki_install_path }}/install.php'
|
||||
state: absent
|
||||
when: not dokuwiki_install # noqa 601 # entspricht when: dokuwiki_update == true; noqa sorgt dafür dass das beispiel nicht "gemeldet" wird # entspricht == false
|
||||
---
|
||||
- name: include install tasks
|
||||
include_tasks: install.yml
|
||||
- name: include apache2 tasks
|
||||
include_tasks: apache2.yml
|
||||
- name: include dokuwiki tasks
|
||||
include_tasks: dokuwiki.yml
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
ErrorLog ${APACHE_LOG_DIR}/dokuwiki_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/dokuwiki_access.log combined
|
||||
DirectoryIndex index.php
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
|
@ -26,6 +27,11 @@
|
|||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
<Directory {{ dokuwiki_install_path }}>
|
||||
AllowOverride All
|
||||
Options -Indexes -MultiViews +FollowSymLinks
|
||||
</Directory>
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## mgrote.sicherung_cloud
|
||||
## mgrote.restic
|
||||
|
||||
### Beschreibung
|
||||
Installiert und konfiguriert restic.
|
||||
|
|
|
@ -36,7 +36,7 @@ fi
|
|||
|
||||
|
||||
|
||||
while [[ "$abbruch_restic" -le {{ restic_anzahl_versuche_backup }} ]] # Schleife für Abbruchbedingung; um die eckikgen Klammern(Befehl "test") muss immer ein leerzeichen sein
|
||||
while [[ "$abbruch_restic" -le {{ restic_anzahl_versuche_backup }} ]] # Schleife für Abbruchbedingung; um die eckigen Klammern(Befehl "test") muss immer ein leerzeichen sein
|
||||
do
|
||||
{ # ist keine Subshell sondern Grouping; https://askubuntu.com/questions/662190/write-the-output-of-multiple-sequential-commands-to-a-text-file
|
||||
echo "--------------------------------------------------" # Trenner logfile
|
||||
|
|
Loading…
Reference in a new issue