working ansible role

This commit is contained in:
Kyattsukuro 2026-10-11 01:16:35 +02:00
parent 02041ea21b
commit ae06d5ca67
6 changed files with 66 additions and 11 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# changedetection

8
defaults/main.yml Normal file
View File

@ -0,0 +1,8 @@
path: /srv/{{ role_name }}
changedetection_override: {}
changedetection_defaults:
version: "latest"
url: ""
oidc:
forwardauth_url: ""

8
handlers/main.yml Normal file
View File

@ -0,0 +1,8 @@
- name: restart container
community.docker.docker_compose_v2:
project_src: "{{ path }}"
project_name: "{{ role_name }}"
recreate: "always"
services: ["changedetection"]
state: "restarted"
when: not _changedetection_already_restarted

20
meta/main.yml Normal file
View File

@ -0,0 +1,20 @@
---
galaxy_info:
author: "Niklas Freese <niklas@urmel.de>"
description: changedetection
company: "Urmel Services"
license: AGPL-3.0-or-later
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies:
- role: traefik

21
tasks/main.yml Normal file
View File

@ -0,0 +1,21 @@
---
- name: "set local variables from overrides and defaults"
set_fact:
changedetection: "{{ (changedetection_defaults | combine(changedetection_override, recursive=True)) if changedetection_override else changedetection_defaults }}"
- name: ensure that path exists
file:
path: "{{ path }}/config/changedetection"
state: directory
- name: template docker compose
template:
src: compose.yml.j2
dest: "{{ path }}/compose.yml"
- name: ensure everything is up
community.docker.docker_compose_v2:
project_src: "{{ path }}"
project_name: "{{ role_name }}"
recreate: always
state: "present"

View File

@ -1,9 +1,8 @@
services: services:
changedetection: changedetection:
image: ghcr.io/dgtlmoon/changedetection.io:0.55.3 image: "ghcr.io/dgtlmoon/changedetection.io:{{ changedetection.version }}" #0.55.3
hostname: changedetection
volumes: volumes:
- changedetection-data:/datastore - ./data/changedetection:/datastore
# Configurable proxy list support, see https://github.com/dgtlmoon/changedetection.io/wiki/Proxy-configuration#proxy-list-support # Configurable proxy list support, see https://github.com/dgtlmoon/changedetection.io/wiki/Proxy-configuration#proxy-list-support
# - ./proxies.json:/datastore/proxies.json # - ./proxies.json:/datastore/proxies.json
@ -33,20 +32,21 @@ services:
traefik.http.services.changedetection.loadbalancer.server.port: "5000" traefik.http.services.changedetection.loadbalancer.server.port: "5000"
traefik.http.services.changedetection.loadbalancer.passhostheader: "true" traefik.http.services.changedetection.loadbalancer.passhostheader: "true"
traefik.http.routers.changedetection-diff.rule: "Host(`changedetection.urmel.de`) && PathPrefix(`/preview`)" traefik.http.routers.changedetection-diff.rule: "Host(`{{ changedetection.url }}`) && PathPrefix(`/preview`)"
traefik.http.routers.changedetection-diff.priority: 100 traefik.http.routers.changedetection-diff.priority: 100
traefik.http.routers.changedetection-diff.service: changedetection traefik.http.routers.changedetection-diff.service: changedetection
traefik.http.routers.changedetection.rule: "Host(`changedetection.urmel.de`) && PathPrefix(`/`)" traefik.http.routers.changedetection.rule: "Host(`{{ changedetection.url }}`) && PathPrefix(`/`)"
traefik.http.routers.changedetection.tls: "true" traefik.http.routers.changedetection.tls: "true"
traefik.http.routers.changedetection.tls.certresolver: hetzner traefik.http.routers.changedetection.tls.certresolver: hetzner
traefik.http.routers.changedetection.priority: 90 traefik.http.routers.changedetection.priority: 90
traefik.http.routers.changedetection.middlewares: changedetection-auth
traefik.http.routers.changedetection.service: changedetection traefik.http.routers.changedetection.service: changedetection
{% if changedetection.oidc.forwardauth_url | length > 0 -%}
traefik.http.middlewares.changedetection-auth.forwardauth.address: "http://authentik-proxy:9000/outpost.goauthentik.io/auth/traefik" traefik.http.routers.changedetection.middlewares: changedetection-auth
traefik.http.middlewares.changedetection-auth.forwardauth.address: "{{ changedetection.oidc.forwardauth_url }}"
traefik.http.middlewares.changedetection-auth.forwardauth.trustForwardHeader: true traefik.http.middlewares.changedetection-auth.forwardauth.trustForwardHeader: true
traefik.http.middlewares.changedetection-auth.forwardauth.authResponseHeaders: X-authentik-username,X-authentik-groups,X-authentik-entitlements,X-authentik-email,X-authentik-name traefik.http.middlewares.changedetection-auth.forwardauth.authResponseHeaders: X-authentik-username,X-authentik-groups,X-authentik-entitlements,X-authentik-email,X-authentik-name
{% endif %}
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
@ -74,6 +74,3 @@ networks:
proxy: proxy:
name: traefik_exposed name: traefik_exposed
external: true external: true
volumes:
changedetection-data: