refactor wallabag

This commit is contained in:
Gabriel Augendre 2024-10-11 18:09:01 +02:00
parent 85623a90f8
commit c6b4cb700b
3 changed files with 29 additions and 11 deletions

View file

@ -1,5 +1,5 @@
---
- name: Setup wallabag
- name: Wallabag
hosts: servers
gather_facts: false
tasks:
@ -8,22 +8,40 @@
path: "{{ dir }}"
state: directory
mode: "0775"
- name: Write env file
ansible.builtin.template:
src: templates/wallabag.env.j2
dest: "{{ dir }}/wallabag.env"
mode: "0644"
- name: Write docker-compose.yaml
- name: Write files
ansible.builtin.copy:
src: files/wallabag-docker-compose.yaml
dest: "{{ dir }}/docker-compose.yaml"
mode: "0644"
src: "{{ item }}"
dest: "{{ dir }}/"
mode: preserve
with_fileglob:
- files/{{ app_name }}/*
- files/{{ app_name }}/.*
notify:
- Restart service
- name: Write templates
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
mode: preserve
with_fileglob:
- templates/{{ app_name }}/*.j2
- templates/{{ app_name }}/.*.j2
notify:
- Restart service
- name: Ensure service is started
community.docker.docker_compose_v2:
project_src: "{{ dir }}"
state: present
handlers:
- name: Restart service
community.docker.docker_compose_v2:
project_src: "{{ dir }}"
state: restarted
vars:
dir: /mnt/data/wallabag
app_name: wallabag
dir: /mnt/data/{{ app_name }}
secret_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
31346432623062383331306633383230376264326530643236393838356166346563653637376666