Skip to main content
Discover Packs Jobs Registries Requests Docs About GitHub

lhaig / nomad-cfddns

Published by Lance Haig | Raw HCL

job
0 stars
Description
Cloudflare Dynamic DNS Periodic Job
License
MPL-2.0
Tags
#cloudflare #dyndns
Download Status
Completed (v0.1.0) Feb 22, 19:43
Versions
Select a version to see its documentation and run command.
Quick Run (v0.1.0)
ramble job run lhaig/nomad-cfddns@v0.1.0
README
# cfddns A Cloudflare dynamic DNS updater for Nomad. ## Overview This job deploys [cfddns](https://github.com/lhaig/cfddns) as a periodic batch job on Nomad. It checks the current public IP and updates Cloudflare DNS records on a cron schedule. Credentials and domain configuration are stored as Nomad variables. ## Requirements - Docker driver enabled on Nomad clients - A Cloudflare API token with DNS edit permissions - Nomad variable at `nomad/jobs/cfddns` containing `api_token` and `domains` keys ## Setup ### 1. Create the Nomad Variable Store your Cloudflare API token and domain list: ```bash nomad var put nomad/jobs/cfddns \ api_token="your-cloudflare-api-token" \ domains='[ {"ZoneID":"your-zone-id","Hostname":"example.com","Proxied":true}, {"ZoneID":"your-zone-id","Hostname":"www.example.com","Proxied":true}, {"ZoneID":"your-zone-id","Hostname":"api.example.com","Proxied":false} ]' ``` Each entry requires: - `ZoneID` - the Cloudflare Zone ID (found in the Cloudflare dashboard under your domain's overview page) - `Hostname` - the DNS record to update - `Proxied` - whether to proxy traffic through Cloudflare (`true`) or DNS-only (`false`) ### 2. Run the Job ```bash nomad job run cfddns.nomad.hcl ``` With custom variables: ```bash nomad job run \ -var='cron=*/30 * * * *' \ -var='datacenters=["dc1","dc2"]' \ cfddns.nomad.hcl ``` ## Variables | Name | Description | Default | |------|-------------|---------| | `datacenters` | List of datacenters to deploy to | `["dc1"]` | | `cfddns_version` | cfddns Docker image tag | `latest` | | `cron` | Cron expression for update schedule | `0 6,18 * * *` | | `nomad_var_path` | Path to the Nomad variable containing credentials | `nomad/jobs/cfddns` | ## How It Works 1. Nomad triggers the batch job on the configured cron schedule 2. The task reads the Cloudflare API token and domain list from Nomad variables 3. cfddns detects the current public IP address 4. DNS records listed in the domains configuration are updated in Cloudflare ## License MPL 2.0