2020-02-18 02:39:55 -06:00
|
|
|
#!/usr/bin/ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
---
|
|
|
|
- name: Install, configure, and start Dokuwiki
|
|
|
|
block:
|
2020-05-03 06:51:52 -05:00
|
|
|
- name: Set up Apache
|
|
|
|
block:
|
|
|
|
- name: Create webroot
|
|
|
|
file:
|
|
|
|
path: "{{ dokuwiki_webroot }}"
|
|
|
|
mode: "0755"
|
|
|
|
recurse: yes
|
|
|
|
state: directory
|
|
|
|
- name: Check for existing installation
|
|
|
|
stat:
|
|
|
|
path: "{{ dokuwiki_webroot }}/index.php"
|
|
|
|
register: stat_webroot_index
|
|
|
|
- name: Install Dokuwiki
|
|
|
|
block:
|
|
|
|
- name: Download Dokuwiki
|
|
|
|
get_url:
|
|
|
|
dest: /var/www/dokuwiki.tgz
|
|
|
|
url: "{{ dokuwiki_tgz }}"
|
|
|
|
- name: Extract Dokuwiki
|
|
|
|
unarchive:
|
|
|
|
src: /var/www/dokuwiki.tgz
|
|
|
|
remote_src: yes
|
|
|
|
dest: "{{ dokuwiki_webroot }}"
|
|
|
|
extra_opts: [--strip-components=1]
|
|
|
|
notify: restart apache
|
|
|
|
- name: Chown webroot
|
|
|
|
file:
|
|
|
|
path: "{{ dokuwiki_webroot }}"
|
|
|
|
state: directory
|
|
|
|
recurse: yes
|
|
|
|
owner: www-data
|
|
|
|
group: www-data
|
|
|
|
- name: Cleanup
|
|
|
|
file:
|
|
|
|
path: /var/www/dokuwiki.tgz
|
|
|
|
state: absent
|
|
|
|
when: not stat_webroot_index.stat.exists
|
|
|
|
- name: Copy over virtual host configs
|
|
|
|
template:
|
|
|
|
src: apache2-vhost-ssl.conf
|
|
|
|
dest: "/etc/apache2/sites-available/{{ dokuwiki_url }}.conf"
|
|
|
|
notify: restart apache
|
|
|
|
- name: Enable config
|
|
|
|
command:
|
|
|
|
cmd: "a2ensite {{ dokuwiki_url }}.conf"
|
|
|
|
creates: "/etc/apache2/sites-enabled/{{ dokuwiki_url }}.conf"
|
|
|
|
notify: restart apache
|
|
|
|
- name: Generate certificate
|
|
|
|
include_role:
|
|
|
|
name: https
|
|
|
|
vars:
|
|
|
|
website_url: "{{ dokuwiki_url }}"
|
|
|
|
website_webroot: "{{ dokuwiki_webroot }}"
|
2020-05-03 06:54:03 -05:00
|
|
|
- name: Template out backup module
|
2020-05-03 06:51:52 -05:00
|
|
|
template:
|
|
|
|
src: "backup.sh"
|
2020-05-03 06:58:09 -05:00
|
|
|
dest: "/opt/backups/modules/{{ dokuwiki_url }}.sh"
|
2020-05-03 06:51:52 -05:00
|
|
|
mode: "0600"
|
2020-02-18 02:39:55 -06:00
|
|
|
become: yes
|