DDNS¶
Overview¶
DDNS is a Saltbox-specific Dynamic DNS service that automatically manages DNS records with Cloudflare based on Traefik routes. This container monitors Traefik's API for active routes and automatically creates or updates corresponding DNS records in Cloudflare, supporting both IPv4 and IPv6.
Info
- This service only works with Cloudflare DNS
- The container requires access to Traefik's API to discover routes
- DNS records are automatically managed based on active Traefik routes
Pre-deployment¶
Prerequisites¶
- Cloudflare must be enabled in your Saltbox configuration
- IPv4 or IPv6 DNS management must be enabled in
adv_settings.yml - Valid Cloudflare API credentials must be configured in
accounts.yml
Custom URLs¶
You can manage additional custom URLs by setting the ddns_custom_urls variable in your Saltbox inventory:
ddns_custom_urls: "subdomain1.domain.com,subdomain2.domain.com"
Deployment¶
sb install ddns
Usage¶
The DDNS container automatically monitors Traefik's API endpoint for active routes and creates or updates corresponding DNS records in Cloudflare based on your configured IP version preferences.
Role Defaults¶
Variables can be customized using the Inventory. (1)
-
Example override
ddns_name: "custom_value"Avoid overriding variables ending in
_defaultWhen overriding variables that end in
_default(likeddns_docker_envs_default), you replace the entire default configuration. Future updates that add new default values will not be applied to your setup, potentially breaking functionality.Instead, use the corresponding
_customvariable (likeddns_docker_envs_custom) to add your changes. Custom values are merged with defaults, ensuring you receive updates.
ddns_name
# Type: string
ddns_name: ddns
ddns_role_custom_urls
# Comma separated FQDN's that you want the container to manage
# Type: string
ddns_role_custom_urls: ""
ddns_role_delay
# Type: string
ddns_role_delay: "60"
Container
ddns_role_docker_container
# Type: string
ddns_role_docker_container: "{{ ddns_name }}"
Image
ddns_role_docker_image_pull
# Type: bool (true/false)
ddns_role_docker_image_pull: true
ddns_role_docker_image_repo
# Type: string
ddns_role_docker_image_repo: "saltydk/dns"
ddns_role_docker_image_tag
# Type: string
ddns_role_docker_image_tag: "latest"
ddns_role_docker_image
# Type: string
ddns_role_docker_image: "{{ lookup('role_var', '_docker_image_repo', role='ddns') }}:{{ lookup('role_var', '_docker_image_tag', role='ddns') }}"
Envs
ddns_role_docker_envs_default
# Type: dict
ddns_role_docker_envs_default:
TZ: "{{ tz }}"
CLOUDFLARE_PROXY_DEFAULT: "{{ dns_proxied | string }}"
CLOUDFLARE_ALLOW_NESTED_PROXY: "{{ cloudflare_allow_nested_proxy | default(false) | string }}"
TRAEFIK_API_URL: "http://traefik:8080"
TRAEFIK_ENTRYPOINTS: "websecure,web"
CUSTOM_URLS: "{{ lookup('role_var', '_custom_urls', role='ddns', default=omit, default_if_empty=true) }}"
IP_VERSION: "{{ 'both' if (dns_ipv4_enabled and dns_ipv6_enabled) else ('4' if dns_ipv4_enabled else '6') }}"
DELAY: "{{ lookup('role_var', '_delay', role='ddns') }}"
ddns_role_docker_envs_cloudflare
# Type: string
ddns_role_docker_envs_cloudflare: "{{ {'CLOUDFLARE_API_TOKEN': cloudflare_scoped_token}
if cloudflare_scoped_token_is_enabled
else {'CLOUDFLARE_API_KEY': cloudflare_api_key,
'CLOUDFLARE_EMAIL': cloudflare_email} }}"
ddns_role_docker_envs_custom
# Type: dict
ddns_role_docker_envs_custom: {}
Volumes
ddns_role_docker_volumes_global
# Type: bool (true/false)
ddns_role_docker_volumes_global: false
Mounts
ddns_role_docker_mounts_default
# Type: list
ddns_role_docker_mounts_default:
- target: /tmp
type: tmpfs
ddns_role_docker_mounts_custom
# Type: list
ddns_role_docker_mounts_custom: []
Hostname
ddns_role_docker_hostname
# Type: string
ddns_role_docker_hostname: "{{ ddns_name }}"
Networks
ddns_role_docker_networks_alias
# Type: string
ddns_role_docker_networks_alias: "{{ ddns_name }}"
ddns_role_docker_networks_default
# Type: list
ddns_role_docker_networks_default: []
ddns_role_docker_networks_custom
# Type: list
ddns_role_docker_networks_custom: []
Restart Policy
ddns_role_docker_restart_policy
# Type: string
ddns_role_docker_restart_policy: unless-stopped
Init
ddns_role_docker_init
# Type: bool (true/false)
ddns_role_docker_init: true
Dependencies
ddns_role_depends_on
# Type: string
ddns_role_depends_on: "traefik"
ddns_role_depends_on_delay
# Type: string (quoted number)
ddns_role_depends_on_delay: "10"
ddns_role_depends_on_healthchecks
# Type: string ("true"/"false")
ddns_role_depends_on_healthchecks: "false"
The following advanced options are available via create_docker_container but are not defined in the role. See: docker_container module
A blank value is YAML null and inherits any lower-precedence role or shared default. Explicit Ansible omit is accepted only for optional Docker settings; default-backed and required settings reject it. Use the documented typed empty value, such as "", [], or {}, when disabling a guaranteed setting.
GPU
ddns_role_docker_gpu_enabled
# Set this to true to let the app use a GPU.
# Intel access also requires gpu.intel: true.
# NVIDIA access also requires nvidia_enabled: true.
# This setting does not install or enable GPU support on the server.
# Type: bool (true/false)
ddns_role_docker_gpu_enabled: false
ddns_role_docker_nvidia_disabled
# Set this to true to turn off automatic NVIDIA access for this app.
# It only has an effect when the app's _docker_gpu_enabled option and
# nvidia_enabled are both true.
# Automatic /dev/dri access may remain.
# Type: bool (true/false)
ddns_role_docker_nvidia_disabled: false
ddns_role_docker_dev_dri_disabled
# Set this to true to stop Saltbox from automatically sharing the
# server's /dev/dri video devices with this app.
# It only has an effect when the app's _docker_gpu_enabled option is true
# and either gpu.intel or nvidia_enabled is true.
# NVIDIA-specific access may remain.
# Type: bool (true/false)
ddns_role_docker_dev_dri_disabled: false
Resource Limits
ddns_role_docker_blkio_weight
# Type: int
ddns_role_docker_blkio_weight:
ddns_role_docker_cpu_period
# Type: int
ddns_role_docker_cpu_period:
ddns_role_docker_cpu_quota
# Type: int
ddns_role_docker_cpu_quota:
ddns_role_docker_cpu_shares
# Type: int
ddns_role_docker_cpu_shares:
ddns_role_docker_cpus
# Type: string
ddns_role_docker_cpus:
ddns_role_docker_cpuset_cpus
# Type: string
ddns_role_docker_cpuset_cpus:
ddns_role_docker_cpuset_mems
# Type: string
ddns_role_docker_cpuset_mems:
ddns_role_docker_kernel_memory
# Type: string
ddns_role_docker_kernel_memory:
ddns_role_docker_memory
# Type: string
ddns_role_docker_memory:
ddns_role_docker_memory_reservation
# Type: string
ddns_role_docker_memory_reservation:
ddns_role_docker_memory_swap
# Type: string
ddns_role_docker_memory_swap:
ddns_role_docker_memory_swappiness
# Type: int
ddns_role_docker_memory_swappiness:
ddns_role_docker_shm_size
# Type: string
ddns_role_docker_shm_size:
Security & Devices
ddns_role_docker_cap_drop
# Type: list
ddns_role_docker_cap_drop:
ddns_role_docker_cgroupns_mode
# Type: string
ddns_role_docker_cgroupns_mode:
ddns_role_docker_device_cgroup_rules
# Type: list
ddns_role_docker_device_cgroup_rules:
ddns_role_docker_device_read_bps
# Type: list
ddns_role_docker_device_read_bps:
ddns_role_docker_device_read_iops
# Type: list
ddns_role_docker_device_read_iops:
ddns_role_docker_device_requests
# Type: list
ddns_role_docker_device_requests:
ddns_role_docker_device_write_bps
# Type: list
ddns_role_docker_device_write_bps:
ddns_role_docker_device_write_iops
# Type: list
ddns_role_docker_device_write_iops:
ddns_role_docker_devices
# Type: list
ddns_role_docker_devices:
ddns_role_docker_groups
# Type: list
ddns_role_docker_groups:
ddns_role_docker_privileged
# Type: bool (true/false)
ddns_role_docker_privileged:
ddns_role_docker_security_opts
# Type: list
ddns_role_docker_security_opts:
ddns_role_docker_user
# Type: string
ddns_role_docker_user:
ddns_role_docker_userns_mode
# Type: string
ddns_role_docker_userns_mode:
Networking
ddns_role_docker_dns_opts
# Type: list
ddns_role_docker_dns_opts:
ddns_role_docker_dns_search_domains
# Type: list
ddns_role_docker_dns_search_domains:
ddns_role_docker_dns_servers
# Type: list
ddns_role_docker_dns_servers:
ddns_role_docker_domainname
# Type: string
ddns_role_docker_domainname:
ddns_role_docker_exposed_ports
# Type: list
ddns_role_docker_exposed_ports:
ddns_role_docker_hosts
# Type: dict
ddns_role_docker_hosts:
ddns_role_docker_hosts_use_common
# Type: bool (true/false)
ddns_role_docker_hosts_use_common:
ddns_role_docker_ipc_mode
# Type: string
ddns_role_docker_ipc_mode:
ddns_role_docker_links
# Type: list
ddns_role_docker_links:
ddns_role_docker_network_mode
# Type: string
ddns_role_docker_network_mode:
ddns_role_docker_pid_mode
# Type: string
ddns_role_docker_pid_mode:
ddns_role_docker_ports
# Type: list
ddns_role_docker_ports:
ddns_role_docker_uts
# Type: string
ddns_role_docker_uts:
Storage
ddns_role_docker_keep_volumes
# Type: bool (true/false)
ddns_role_docker_keep_volumes:
ddns_role_docker_storage_opts
# Type: dict
ddns_role_docker_storage_opts:
ddns_role_docker_tmpfs
# Type: list
ddns_role_docker_tmpfs:
ddns_role_docker_volume_driver
# Type: string
ddns_role_docker_volume_driver:
ddns_role_docker_volumes
# Type: list
ddns_role_docker_volumes:
ddns_role_docker_volumes_from
# Type: list
ddns_role_docker_volumes_from:
ddns_role_docker_working_dir
# Type: string
ddns_role_docker_working_dir:
Monitoring & Lifecycle
ddns_role_docker_auto_remove
# Type: bool (true/false)
ddns_role_docker_auto_remove:
ddns_role_docker_cleanup
# Type: bool (true/false)
ddns_role_docker_cleanup:
ddns_role_docker_force_kill
# Type: string
ddns_role_docker_force_kill:
ddns_role_docker_healthcheck
# Type: dict
ddns_role_docker_healthcheck:
ddns_role_docker_healthy_wait_timeout
# Type: int
ddns_role_docker_healthy_wait_timeout:
ddns_role_docker_kill_signal
# Type: string
ddns_role_docker_kill_signal:
ddns_role_docker_log_driver
# Type: string
ddns_role_docker_log_driver:
ddns_role_docker_log_options
# Type: dict
ddns_role_docker_log_options:
ddns_role_docker_oom_killer
# Type: bool (true/false)
ddns_role_docker_oom_killer:
ddns_role_docker_oom_score_adj
# Type: int
ddns_role_docker_oom_score_adj:
ddns_role_docker_output_logs
# Type: bool (true/false)
ddns_role_docker_output_logs:
ddns_role_docker_paused
# Type: bool (true/false)
ddns_role_docker_paused:
ddns_role_docker_recreate
# Type: bool (true/false)
ddns_role_docker_recreate:
ddns_role_docker_restart_retries
# Type: int
ddns_role_docker_restart_retries:
ddns_role_docker_stop_signal
# Type: string
ddns_role_docker_stop_signal:
ddns_role_docker_stop_timeout
# Type: int
ddns_role_docker_stop_timeout:
Other Options
ddns_role_docker_capabilities
# Type: list
ddns_role_docker_capabilities:
ddns_role_docker_cgroup_parent
# Type: string
ddns_role_docker_cgroup_parent:
ddns_role_docker_commands
# Type: list
ddns_role_docker_commands:
ddns_role_docker_create_timeout
# Type: int
ddns_role_docker_create_timeout:
ddns_role_docker_entrypoint
# Type: string
ddns_role_docker_entrypoint:
ddns_role_docker_env_file
# Type: string
ddns_role_docker_env_file:
ddns_role_docker_labels
# Type: dict
ddns_role_docker_labels:
ddns_role_docker_labels_use_common
# Type: bool (true/false)
ddns_role_docker_labels_use_common:
ddns_role_docker_read_only
# Type: bool (true/false)
ddns_role_docker_read_only:
ddns_role_docker_runtime
# Type: string
ddns_role_docker_runtime:
ddns_role_docker_sysctls
# Type: list
ddns_role_docker_sysctls:
ddns_role_docker_ulimits
# Type: list
ddns_role_docker_ulimits:
ddns_role_autoheal_enabled
# Enable or disable Autoheal monitoring for the container created when deploying
# Type: bool (true/false)
ddns_role_autoheal_enabled: true
ddns_role_diun_enabled
# Enable or disable Diun update notifications for the container created when deploying
# Type: bool (true/false)
ddns_role_diun_enabled: true
ddns_role_docker_controller
# Enable or disable Saltbox Docker Controller management for the container
# Type: bool (true/false)
ddns_role_docker_controller: true
ddns_role_docker_networks_alias_custom
# Type: list
ddns_role_docker_networks_alias_custom:
ddns_role_docker_volumes_download
# Type: bool (true/false)
ddns_role_docker_volumes_download: