add wallabag

This commit is contained in:
Frank Adaemmer 2022-09-18 19:29:12 +02:00
parent a501902ce7
commit e60a01d410
8 changed files with 190 additions and 0 deletions

3
roles/wallabag/README.md Normal file
View file

@ -0,0 +1,3 @@
# wallabag
Build a wallabag docker image and run a wallabag docker container.

View file

@ -0,0 +1,3 @@
---
# defaults file for wallabag
wallabag_build_path: /srv/build_containers/walabag

View file

@ -0,0 +1,2 @@
---
# handlers file for wallabag

View file

@ -0,0 +1,91 @@
---
argument_specs:
# roles/myapp/tasks/main.yml entry point
main:
short_description: Build a wallabag docker image and run a wallabag docker container.
options:
wallabag_data_volume:
description: Volume for wallabag data
type: str
required: false
default: wallabag
wallabag_images_volume:
description: Volume for wallabag images
type: str
required: false
default: wallabag
wallabag_build_path:
description: Path to docker image build directory
type: str
required: false
default: /srv/build_containers/wallabag
force_recreate:
description: Force build and recreate container
type: bool
required: false
default: false
wallabag_domain:
description: Domain name of this wallabag instance (e.g. wallabag.example.com)
type: str
required: true
letsencrypt_mail:
description: Email address for Let's Encrypt certificate (e.g. letsencrypt@example.com)
type: str
required: true
wallabag_secret:
description: Wallabag instance secret
type: str
required: true
wallabag_email:
description: Sender email address for mails from the wallabag instance (e.g. wallabag@example.com)
type: str
required: true
build:
short_description: Build a wallabag docker image
options:
wallabag_build_path:
description: Path to docker image build directory
type: str
required: false
default: /srv/build_containers/wallabag
force_recreate:
description: Force build
type: bool
required: false
default: false
run:
short_description: Run a wallabag docker container
options:
wallabag_data_volume:
description: Volume for wallabag data
type: str
required: false
default: wallabag_data
wallabag_images_volume:
description: Volume for wallabag images
type: str
required: false
default: wallabag_images
force_recreate:
description: Force recreate container
type: bool
required: false
default: false
wallabag_domain:
description: Domain name of this wallabag instance (e.g. wallabag.example.com)
type: str
required: true
letsencrypt_mail:
description: Email address for Let's Encrypt certificate (e.g. letsencrypt@example.com)
type: str
required: true
wallabag_secret:
description: Wallag instance secret
type: str
required: true
wallabag_email:
description: Sender email address for mails from the wallabag instance (e.g. wallabag@example.com)
type: str
required: true

View file

@ -0,0 +1,12 @@
galaxy_info:
author: Frank Adaemmer <frank@adaemmer.com>
description: Build and run a wallabag container
license: GPL-3.0-or-later
min_ansible_version: '2.9'
platforms:
- name: GenericLinux
version:
- any
galaxy_tags: [docker]

View file

@ -0,0 +1,23 @@
---
- name: Clone wallabag docker
ansible.builtin.git:
repo: https://github.com/wallabag/docker.git
dest: "{{ wallabag_build_path }}"
version: master
- name: Build wallabag image
community.docker.docker_image:
name: copyrights/wallabag
tag: latest
build:
path: "{{ wallabag_build_path }}"
pull: true
nocache: "{{ force_recreate | default(false) }}"
source: build
force_source: true
state: present
become: true
retries: 3
delay: 60
until: current_task is not failed
register: current_task

View file

@ -0,0 +1,7 @@
---
# tasks file for wallabag
- name: Build wallabag image
ansible.builtin.import_tasks: build.yml
- name: Create wallabag
ansible.builtin.import_tasks: run.yml

View file

@ -0,0 +1,49 @@
---
- name: Create wallabag
community.docker.docker_container:
name: wallabag
detach: true
image: copyrights/wallabag
# pull: true
labels:
com.centurylinklabs.watchtower.enable: 'true'
traefik.enable: "true"
traefik.http.routers.wallabag.entrypoints: "http"
traefik.http.routers.wallabag.rule: "Host(`{{ wallabag_domain }}`)"
traefik.http.middlewares.wallabag-https-redirect.redirectscheme.scheme: "https"
traefik.http.routers.wallabag.middlewares: "wallabag-https-redirect"
traefik.http.routers.wallabag-secure.entrypoints: "https"
traefik.http.routers.wallabag-secure.rule: "Host(`{{ wallabag_domain }}`)"
traefik.http.routers.wallabag-secure.tls: "true"
traefik.http.routers.wallabag-secure.tls.certresolver: "http"
# traefik.http.routers.wallabag-secure.service: "wallabag"
# traefik.http.services.wallabag.loadbalancer.server.port: "80"
traefik.docker.network: "webnet"
# traefik.backend.healthcheck.path: "/health"
networks:
- name: webnet
network_mode: default
recreate: "{{ force_recreate | default(omit) }}"
comparisons:
image: strict
env: strict
volumes: strict
restart_policy: always
state: started
volumes:
- '{{ wallabag_data_volume }}:/var/www/wallabag/data'
- '{{ wallabag_images_volume }}:/var/www/wallabag/web/assets/images'
env:
VIRTUAL_HOST: "{{ wallabag_domain }}"
LETSENCRYPT_HOST: "{{ wallabag_domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_mail }}"
SYMFONY__ENV__SECRET: "{{ wallabag_secret }}"
SYMFONY__ENV__FROM_EMAIL: "{{ wallabag_email }}"
SYMFONY__ENV__FOSUSER_CONFIRMATION: 'false'
SYMFONY__ENV__DOMAIN_NAME: "https://{{ wallabag_domain }}"
become: true
retries: 3
delay: 60
until: current_task is not failed
register: current_task