Add wallabag docker deployment role

Added role of wallabag. Can take a subdomain alias to be presented on a
different uri than its stack name.

All services contain a healthcheck for docker swarm to be informed of
their status.

Copy whoami template to wallabag role

Change non-domain domain name to localhost

Fix correct handler notify naming

Allow setting different subdomain alias than name

Add meta information
This commit is contained in:
Marty Oehme 2021-10-08 10:05:23 +02:00
parent 80185e39dd
commit ebd995b8c4
Signed by: Marty
GPG key ID: B7538B8F50A1C800
9 changed files with 226 additions and 0 deletions

View file

@ -0,0 +1,53 @@
## Register reverse proxy
- name: Ensure upstream directory exists
ansible.builtin.file:
path: "{{ wallabag_upstream_file_dir }}"
state: directory
mode: '0755'
become: yes
listen: "update wallabag upstream"
- name: Update upstream template
ansible.builtin.template:
src: upstream.json.j2
dest: "{{ wallabag_upstream_file_dir }}/upstream.json"
become: yes
listen: "update wallabag upstream"
# figure out if upstream id exists
- name: check {{ stack.name }} upstream
community.docker.docker_container_exec:
container: "{{ caddy_container_id }}"
command: >
curl localhost:2019/id/{{ stack.name }}_upstream/
changed_when: False
register: result
become: yes
listen: "update wallabag upstream"
# upstream already exists, patch it
- name: remove old {{ stack.name }} upstream
community.docker.docker_container_exec:
container: "{{ caddy_container_id }}"
command: >
curl -X DELETE localhost:2019/id/{{ stack.name }}_upstream/
become: yes
when: (result.stdout | from_json)['error'] is not defined
listen: "update wallabag upstream"
# upstream has to be created
- name: add {{ stack.name }} upstream
community.docker.docker_container_exec:
container: "{{ caddy_container_id }}"
command: >
curl -X POST -H "Content-Type: application/json" -d @{{ wallabag_upstream_file_dir }}/upstream.json localhost:2019/config/apps/http/servers/{{ (wallabag_use_https == True) | ternary(caddy_https_server_name, caddy_http_server_name) }}/routes/0/
become: yes
listen: "update wallabag upstream"
- name: Ensure upstream directory is gone again
ansible.builtin.file:
path: "{{ wallabag_upstream_file_dir }}"
state: absent
become: yes
listen: "update wallabag upstream"