6 changed files with 185 additions and 165 deletions
@ -1,36 +1,113 @@ |
|||||||
--- |
--- |
||||||
# NOTE: https://wiki.alpinelinux.org/wiki/DokuWiki |
# NOTE: https://wiki.alpinelinux.org/wiki/DokuWiki |
||||||
|
- name: testing ssh connection to container |
||||||
|
hosts: dokuwiki |
||||||
|
tags: containers |
||||||
|
vars: |
||||||
|
lighttpd_user: lighttpd |
||||||
|
lighttpd_group: lighttpd |
||||||
|
docroot: /var/www/localhost/htdocs |
||||||
|
doku_url: https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz |
||||||
|
doku_tar: /tmp/dokuwiki-stable.tgz |
||||||
|
doku_dir: "{{ docroot }}/dokuwiki" |
||||||
|
tasks: |
||||||
|
- name: install packages |
||||||
|
vars: |
||||||
|
packages: |
||||||
|
- lighttpd |
||||||
|
- php7-common |
||||||
|
- php7-session |
||||||
|
- php7-iconv |
||||||
|
- php7-json |
||||||
|
- php7-gd |
||||||
|
- php7-curl |
||||||
|
- php7-xml |
||||||
|
- php7-mysqli |
||||||
|
- php7-imap |
||||||
|
- php7-cgi |
||||||
|
- php7-pdo |
||||||
|
- php7-pdo_mysql |
||||||
|
- php7-soap |
||||||
|
- php7-xmlrpc |
||||||
|
- php7-posix |
||||||
|
- php7-mcrypt |
||||||
|
- php7-gettext |
||||||
|
- php7-ldap |
||||||
|
- php7-ctype |
||||||
|
- php7-dom |
||||||
|
- fcgi |
||||||
|
- tar |
||||||
|
apk: |
||||||
|
name: "{{ packages | join(' ') }}" |
||||||
|
state: present |
||||||
|
|
||||||
- name: test task variables |
# TODO: break out lighttpd default config to a separate playlist |
||||||
debug: |
|
||||||
var: doku_lxc_cmd |
|
||||||
|
|
||||||
- name: install packages |
- name: copy lighttpd.conf |
||||||
vars: |
copy: |
||||||
packages: |
src: ../templates/lighttpd.conf.j2 |
||||||
- lighttpd |
dest: /etc/lighttpd/lighttpd.conf |
||||||
- php7-common |
|
||||||
- php7-session |
- name: ensure lighttpd service is started |
||||||
- php7-iconv |
service: |
||||||
- php7-json |
name: lighttpd |
||||||
- php7-gd |
enabled: yes |
||||||
- php7-curl |
state: started |
||||||
- php7-xml |
|
||||||
- php7-mysqli |
- name: test if dokuwiki was already installed |
||||||
- php7-imap |
find: |
||||||
- php7-cgi |
paths: "{{ doku_dir }}" |
||||||
- php7-pdo |
pattern: README |
||||||
- php7-pdo_mysql |
register: doku_find_result |
||||||
- php7-soap |
|
||||||
- php7-xmlrpc |
- name: download dokuwiki stable |
||||||
- php7-posix |
get_url: |
||||||
- php7-mcrypt |
url: "{{ doku_url }}" |
||||||
- php7-gettext |
dest: "{{ doku_tar }}" |
||||||
- php7-ldap |
when: doku_find_result.matched == 0 |
||||||
- php7-ctype |
|
||||||
- php7-dom |
- name: make directory for dokiwiki in docroot |
||||||
- fcgi |
file: |
||||||
command: |
path: "{{ doku_dir }}" |
||||||
"{{ lxc_cmd }} exec dokuwiki -- apk add {{ packages | join(' ') }}" |
state: directory |
||||||
when: True |
owner: "{{ lighttpd_user }}" |
||||||
|
group: "{{ lighttpd_group }}" |
||||||
|
when: doku_find_result.matched == 0 |
||||||
|
|
||||||
|
- name: unarchive downloaded file |
||||||
|
unarchive: |
||||||
|
remote_src: yes |
||||||
|
src: "{{ doku_tar }}" |
||||||
|
dest: /tmp |
||||||
|
owner: "{{ lighttpd_user }}" |
||||||
|
group: "{{ lighttpd_group }}" |
||||||
|
when: doku_find_result.matched == 0 |
||||||
|
|
||||||
|
- 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 }}" |
||||||
|
when: doku_tmp_dir.matched > 0 |
||||||
|
|
||||||
|
- name: remove archive |
||||||
|
file: |
||||||
|
path: "{{ doku_tar }}" |
||||||
|
state: absent |
||||||
|
|
||||||
|
- name: remove temporary files |
||||||
|
file: |
||||||
|
path: "{{ doku_tmp_dir.files[0].path }}" |
||||||
|
state: absent |
||||||
|
when: doku_tmp_dir.matched > 0 |
||||||
|
|
||||||
|
# TODO: copy archived dokuwiki files |
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,32 @@ |
|||||||
|
|
||||||
|
var.basedir = "/var/www/localhost" |
||||||
|
var.logdir = "/var/log/lighttpd" |
||||||
|
var.statedir = "/var/lib/lighttpd" |
||||||
|
|
||||||
|
server.modules = ( |
||||||
|
"mod_access", |
||||||
|
"mod_accesslog", |
||||||
|
"mod_rewrite" |
||||||
|
) |
||||||
|
|
||||||
|
include "mime-types.conf" |
||||||
|
include "mod_fastcgi.conf" |
||||||
|
|
||||||
|
server.username = "lighttpd" |
||||||
|
server.groupname = "lighttpd" |
||||||
|
server.document-root = var.basedir + "/htdocs" |
||||||
|
server.pid-file = "/run/lighttpd.pid" |
||||||
|
server.errorlog = var.logdir + "/error.log" |
||||||
|
server.indexfiles = ("index.php", "index.html", "index.htm", "default.htm") |
||||||
|
server.follow-symlink = "enable" |
||||||
|
|
||||||
|
static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi") |
||||||
|
|
||||||
|
accesslog.filename = var.logdir + "/access.log" |
||||||
|
|
||||||
|
url.access-deny = ("~", ".inc") |
||||||
|
|
||||||
|
$HTTP["url"] =~ "^/dokuwiki/(data|conf|bin|inc|vendor)/+." { |
||||||
|
url.access-deny = ("") |
||||||
|
} |
||||||
|
|
||||||
Loading…
Reference in new issue