Ansible role: ddns-updater (dynamic DNS) via Docker
- Jinja 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
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> |
||
| defaults | ||
| meta | ||
| tasks | ||
| templates | ||
| README.md | ||
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
- Fails if
ddns_updater_settingsis empty or a record lacks aproviderordomain. - Installs
python3-docker. - Creates
ddns_updater_dir, owned byddns_updater_owner. - Generates
ddns_updater_dir/config.json(mode 0600) and restarts the container when it changes - it's only read at startup. - Runs the
ddns-updatercontainer asddns_updater_owner's uid:gid onddns_updater_network_name, published on127.0.0.1:ddns_updater_host_portonly. - Waits for the web UI to answer.
Requirements
- Docker already installed on the target (e.g. via
geerlingguy.docker). - The
community.dockercollection.
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.