home-server/roles/dmz_wallabag_front/tasks/main.yml

100 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
# The home-server project produces a multi-purpose setup using Ansible.
# Copyright © 20182023 Y. Gablin, under the GPL-3.0-or-later license.
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
### UPSTREAM BEGIN ⇒ ###
- name: pull prerequisites from upstream
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=upstream.yml
vars:
msg: wallabag
### ⇐ UPSTREAM BEGIN ###
- name: install AUR software
include_role:
name: aur.inc
allow_duplicates: true
vars:
packages:
- wallabag
aur_user: git
### UPSTREAM END ⇒ ###
- name: merge upstream
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=merge.yml
vars:
msg: wallabag
### ⇐ UPSTREAM END ###
- name: configure wallabag
lineinfile:
path: /etc/webapps/wallabag/parameters.yml
regexp: '^\s*{{item.key}}:'
line: ' {{item.key}}: {{item.value}}'
with_dict:
database_driver: pdo_pgsql
database_host: /run/shared_sockets
database_port: 5432
database_name: '{{wallabag_db}}'
database_user: '{{wallabag_db_user}}'
database_password: '{{wallabag_db_password}}'
database_path: 'null'
database_table_prefix: wallabag_
database_socket: 'null'
locale: '{{locales_default | truncate(2, True, "", 0)}}'
#- name: check that wallabag is already initialized
# shell: >
# grep -E '^[[:blank:]]*init_done:[[:blank:]]*true$'
# /etc/webapps/wallabag/parameters.yml || true
# register: check_init_wallabag
# changed_when: false
#
#- name: run the initialization script
# command: >
# ./bin/console wallabag:install -e prod --quiet --no-interaction --no-debug
# become: true
# become_user: http
# args:
# chdir: /usr/share/webapps/wallabag
# when:
# - ((check_init_wallabag.stdout is not defined) or (check_init_wallabag.stdout == ''))
#
#- name: initialization done
# lineinfile:
# path: /etc/webapps/wallabag/parameters.yml
# regexp: '^\s*init_done:'
# line: ' init_done: true'
- name: configure nginx for wallabag
copy:
content: |
location {{http_pfx_wallabag}} {
alias /usr/share/webapps/wallabag/web;
try_files $uri @wallabag;
}
location @wallabag {
rewrite ^ {{http_pfx_wallabag}}/app.php/$is_args$args;
}
location ~ ^{{http_pfx_wallabag}}/app\.php(/|$) {
alias /usr/share/webapps/wallabag/web;
rewrite ^({{http_pfx_wallabag}})(/.*?\.php)(/.*)?$ /php...$document_root/...$1/...$2/...$3 last;
}
location ~ ^{{http_pfx_wallabag}}.*\.php$ {
return 404;
}
dest: /etc/nginx/inc.d/wallabag.https.inc
mode: 0440
owner: http
group: http
notify:
- restart openresty.service
### LOCAL COMMIT ⇒ ###
- name: commit local changes
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=local.yml
vars:
msg: wallabag
### ⇐ LOCAL COMMIT ###
- meta: flush_handlers