Ansible role: ddns-updater (dynamic DNS) via Docker
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Paul Provost 8ff6848cfe Restart on config change from the container task, not a handler
A bare docker_container handler recreated the container from image
defaults (no volumes, ports or env) on community.docker 5.x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:56:04 -04:00
defaults Initial ddns-updater role 2026-10-19 19:49:53 -04:00
meta Initial ddns-updater role 2026-10-19 19:49:53 -04:00
tasks Restart on config change from the container task, not a handler 2026-10-19 19:56:04 -04:00
templates Initial ddns-updater role 2026-10-19 19:49:53 -04:00
README.md Restart on config change from the container task, not a handler 2026-10-19 19:56:04 -04:00

ansible-role-ddns-updater

Deploys ddns-updater via the qmcgaw/ddns-updater Docker image to keep dynamic DNS records (Dynu, Cloudflare, DuckDNS, ...) pointed at the host's public IP. Records come from variables, and updates and failures can be sent anywhere shoutrrr reaches (ntfy, email, ...). A small status web UI is served on the container's port.

What it does

  1. Fails if ddns_updater_settings is empty or a record lacks a provider or domain.
  2. Installs python3-docker.
  3. Creates ddns_updater_dir, owned by ddns_updater_owner.
  4. Generates ddns_updater_dir/config.json (mode 0600) and restarts the container when it changes - it's only read at startup.
  5. Runs the ddns-updater container as ddns_updater_owner's uid:gid on ddns_updater_network_name, published on 127.0.0.1:ddns_updater_host_port only.
  6. Waits for the web UI to answer.

Requirements

  • Docker already installed on the target (e.g. via geerlingguy.docker).
  • The community.docker collection.

Variables

Variable Default Description
ddns_updater_dir ~/local/ddns-updater config.json and updates.json (IP history)
ddns_updater_image qmcgaw/ddns-updater:latest Docker image
ddns_updater_memory 64m Container memory limit
ddns_updater_owner the connecting user Host user the container runs as
ddns_updater_network_name proxy Network shared with a reverse proxy
ddns_updater_port 8000 Web UI port inside the container
ddns_updater_host_port 8000 Loopback host port
ddns_updater_period 5m Public IP check interval
ddns_updater_cooldown 5m Minimum time between updates of one record
ddns_updater_settings [] (required) Records, as config.json settings entries
ddns_updater_shoutrrr_addresses [] shoutrrr notification URLs
ddns_updater_extra_env {} Extra container environment

Example

ddns_updater_settings:
  - provider: dynu
    domain: myhost.dynu.net
    username: me
    password: "{{ dynu_password }}"   # plain, MD5 or SHA256
    ip_version: ipv4
ddns_updater_shoutrrr_addresses:
  - "ntfy://me:{{ ntfy_password | urlencode | replace('/', '%2F') }}@ntfy.example.com/ddns"

Notes

  • Provider keys are documented per provider in the upstream docs.
  • The web UI has no authentication; keep it on loopback or behind a LAN-only reverse proxy.