Refactor wallabag stack name and repo variables

Brought in line with other stack naming schemes.
This commit is contained in:
Marty Oehme 2023-12-08 20:34:41 +01:00
parent 9cf43d0d5d
commit a52cab2f61
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
6 changed files with 17 additions and 20 deletions

View file

@ -6,7 +6,7 @@ Contains only a single deployed image and a couple of simple variables to set.
## Variables ## Variables
``` ```
wallabag_upstream_file_dir: "{{ docker_stack_files_dir }}/{{ stack.name }}" wallabag_upstream_file_dir: "{{ docker_stack_files_dir }}/{{ stack_name }}"
``` ```
The on-target directory where the proxy configuration file should be stashed. The on-target directory where the proxy configuration file should be stashed.

View file

@ -2,7 +2,7 @@
wallabag_version: latest wallabag_version: latest
wallabag_upstream_file_dir: "{{ docker_stack_files_dir }}/{{ stack.name }}" wallabag_upstream_file_dir: "{{ docker_stack_files_dir }}/{{ stack_name }}"
wallabag_use_https: true wallabag_use_https: true

View file

@ -15,28 +15,28 @@
listen: "update wallabag upstream" listen: "update wallabag upstream"
# figure out if upstream id exists # figure out if upstream id exists
- name: check {{ stack.name }} upstream - name: check {{ stack_name }} upstream
community.docker.docker_container_exec: community.docker.docker_container_exec:
container: "{{ caddy_container_id }}" container: "{{ caddy_container_id }}"
command: > command: >
curl localhost:2019/id/{{ stack.name }}_upstream/ curl localhost:2019/id/{{ stack_name }}_upstream/
changed_when: False changed_when: False
register: result register: result
become: true become: true
listen: "update wallabag upstream" listen: "update wallabag upstream"
# upstream already exists, patch it # upstream already exists, patch it
- name: remove old {{ stack.name }} upstream - name: remove old {{ stack_name }} upstream
community.docker.docker_container_exec: community.docker.docker_container_exec:
container: "{{ caddy_container_id }}" container: "{{ caddy_container_id }}"
command: > command: >
curl -X DELETE localhost:2019/id/{{ stack.name }}_upstream/ curl -X DELETE localhost:2019/id/{{ stack_name }}_upstream/
become: true become: true
when: (result.stdout | from_json)['error'] is not defined when: (result.stdout | from_json)['error'] is not defined
listen: "update wallabag upstream" listen: "update wallabag upstream"
# upstream has to be created # upstream has to be created
- name: add {{ stack.name }} upstream - name: add {{ stack_name }} upstream
community.docker.docker_container_exec: community.docker.docker_container_exec:
container: "{{ caddy_container_id }}" container: "{{ caddy_container_id }}"
command: > command: >
@ -50,4 +50,3 @@
state: absent state: absent
become: true become: true
listen: "update wallabag upstream" listen: "update wallabag upstream"

View file

@ -4,7 +4,7 @@
community.docker.docker_container_exec: community.docker.docker_container_exec:
container: "{{ caddy_container_id }}" container: "{{ caddy_container_id }}"
command: > command: >
curl localhost:2019/id/{{ stack.name }}_upstream/ curl localhost:2019/id/{{ stack_name }}_upstream/
register: result register: result
changed_when: (result.stdout | from_json) != (lookup('template', 'upstream.json.j2') | from_yaml) changed_when: (result.stdout | from_json) != (lookup('template', 'upstream.json.j2') | from_yaml)
become: true become: true
@ -12,14 +12,12 @@
- name: Deploy wallabag to swarm - name: Deploy wallabag to swarm
community.general.docker_stack: community.general.docker_stack:
name: "{{ stack.name }}" name: "{{ stack_name }}"
state: present state: present
prune: yes prune: yes
compose: compose:
- "{{ stack.compose }}" - "{{ stack_compose }}"
when: stack is defined
become: true become: true
tags: tags:
- docker-swarm - docker-swarm
notify: "update wallabag upstream" notify: "update wallabag upstream"

View file

@ -1,5 +1,5 @@
{ {
"@id": "{{ stack.name }}_upstream", "@id": "{{ stack_name }}_upstream",
{% if server_domain is not undefined and not none %} {% if server_domain is not undefined and not none %}
"match": [ "match": [
{ {
@ -7,7 +7,7 @@
{% if subdomain_alias is not undefined and not none %} {% if subdomain_alias is not undefined and not none %}
"{{ subdomain_alias }}.{{ server_domain }}" "{{ subdomain_alias }}.{{ server_domain }}"
{% else %} {% else %}
"{{ stack.name }}.{{ server_domain }}" "{{ stack_name }}.{{ server_domain }}"
{% endif %} {% endif %}
] ]
} }
@ -19,7 +19,7 @@
{% if subdomain_alias is not undefined and not none %} {% if subdomain_alias is not undefined and not none %}
"/{{ subdomain_alias }}*" "/{{ subdomain_alias }}*"
{% else %} {% else %}
"/{{ stack.name }}*" "/{{ stack_name }}*"
{% endif %} {% endif %}
] ]
} }
@ -30,7 +30,7 @@
"handler": "reverse_proxy", "handler": "reverse_proxy",
"upstreams": [ "upstreams": [
{ {
"dial": "{{ stack.name }}_app:80" "dial": "{{ stack_name }}_app:80"
} }
] ]
} }

View file

@ -1,7 +1,7 @@
--- ---
stack: stack_name: wallabag
name: wallabag
compose: "{{ lookup('template', 'docker-stack.yml.j2') | from_yaml }}"
stack_image: "wallabag/wallabag" stack_image: "wallabag/wallabag"
stack_compose: "{{ lookup('template', 'docker-stack.yml.j2') | from_yaml }}"