Manage DNS zones declaratively across multiple providers using octoDNS. Think of it as "infrastructure as code" but for DNS records.
octoDNS operates on "desired state" - the YAML file represents the ENTIRE zone.
If the zone file has 1 record but DNS has 50 records, octoDNS will DELETE 49 records.
MANDATORY SAFETY WORKFLOW:
scripts/dump.sh)--doit)scripts/install.sh
This installs octoDNS core plus the easyDNS provider.
If managing an existing zone with records already in DNS:
scripts/dump.sh example.com.
This creates config/example.com.yaml with ALL current records. Skipping this step will delete existing records!
scripts/init_config.sh example.com
Creates config/production.yaml with easyDNS provider configured.
Create config/example.com.yaml:
---
# Root record (@)
'':
ttl: 300
type: A
value: 192.0.2.1
# www subdomain
www:
ttl: 300
type: CNAME
value: example.com.
# Mail records
'':
ttl: 300
type: MX
values:
- priority: 10
value: mail.example.com.
Always preview first - look for unexpected Delete lines:
scripts/sync.sh
(Note: dry-run is the default - no flag needed)
scripts/sync.sh --doit
scripts/sync.sh --zone example.com --doit
scripts/dump.sh example.com
Creates config/example.com.yaml from live DNS.
scripts/validate.sh config/example.com.yaml
scripts/sync_providers.sh route53 easydns example.com
Edit config/production.yaml:
providers:
config:
class: octodns.provider.yaml.YamlProvider
directory: ./config
easydns:
class: octodns_easydns.EasyDnsProvider
token: env/EASYDNS_TOKEN
api_key: env/EASYDNS_API_KEY
portfolio: env/EASYDNS_PORTFOLIO
zones:
example.com:
sources:
- config
targets:
- easydns
Set these for easyDNS:
export EASYDNS_TOKEN="your-api-token"
export EASYDNS_API_KEY="your-api-key"
export EASYDNS_PORTFOLIO="your-portfolio-id"
easyDNS provider supports:
Use dynamic zone config to manage all zones in a directory:
zones:
'*':
sources:
- config
targets:
- easydns
Any .yaml file in config/ becomes a zone.
See references/migration.md for migrating zones between DNS providers.
See references/dynamic-dns.md for automated DNS updates from scripts.
config/scripts/sync.sh --noop to previewscripts/sync.sh --doit to apply"Provider not found": Install provider package:
pip install octodns-easydns
"Authentication failed": Check environment variables are set correctly.
"Zone not found": Ensure zone exists in DNS provider first, or use --force to create.
共 2 个版本