This commit is contained in:
Kyattsukuro 2026-10-12 23:40:55 +02:00
commit c95d94207f
6 changed files with 74 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# ddns

9
defaults/main.yml Normal file
View File

@ -0,0 +1,9 @@
path: /srv/{{ role_name }}
ddns_override: {}
ddns_defaults:
domains: {}
# - provider: ""
# domain: ""
# ip_version: ""
# token: ""

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"
state: "restarted"
services: ["ddns"]
when: not _ddns_already_restarted

19
meta/main.yml Normal file
View File

@ -0,0 +1,19 @@
---
galaxy_info:
author: "Niklas Freese <niklas@urmel.de>"
description: DDNS
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: []

25
tasks/main.yml Normal file
View File

@ -0,0 +1,25 @@
---
- name: "set local variables from overrides and defaults"
set_fact:
ddns: "{{ (ddns_defaults | combine(ddns_override, recursive=True)) if ddns_override else ddns_defaults }}"
- name: ensure that path exists
file:
path: "{{ path }}"
state: directory
- name: template docker-compose
template:
src: compose.yml.j2
dest: "{{ path }}/compose.yml"
notify: restart container
- name: ensure container is running
community.docker.docker_compose_v2:
project_src: "{{ path }}"
project_name: "{{ role_name }}"
state: "present"
pull: "always"
wait: true
services: ["ddns"]
register: _compose_result

12
templates/compose.yml.j2 Normal file
View File

@ -0,0 +1,12 @@
---
services:
ddns:
image: qmcgaw/ddns-updater
restart: always
network_mode: bridge
environment:
RESOLVER_ADDRESS: 1.1.1.1:53
{% set config = {'settings': ddns.domains} | to_json -%}
CONFIG: '{{ config }}'
# ports:
# - 8999:8000