A simple and lightweight tool to manage OVH DNS zones via YAML configuration files.
- Export existing DNS zones from OVH to YAML format
- One-way synchronization from YAML configuration to OVH DNS
- Dry-run mode to preview changes before applying
- One-shot execution - runs, applies changes, and exits
go build -o ovh-dns-manager ./main.gopodman build -t ovh-dns-manager .Creates a minimal ~5-8MB scratch-based container
You can configure OVH credentials using either environment variables (recommended for containers) or YAML files.
export OVH_ENDPOINT=ovh-eu # ovh-eu, ovh-ca, ovh-us
export OVH_APPLICATION_KEY=your_application_key
export OVH_APPLICATION_SECRET=your_application_secret
export OVH_CONSUMER_KEY=your_consumer_key
export OVH_TIMEOUT=30 # seconds (optional, defaults to 30)Create ovh-credentials.yaml:
endpoint: ovh-eu # ovh-eu, ovh-ca, ovh-us
application_key: your_application_key
application_secret: your_application_secret
consumer_key: your_consumer_key
timeout: 30 # secondsConfiguration precedence: Environment variables → YAML file → defaults
To obtain credentials:
- Go to OVH API Console
- Set rights for
/domain/zone/*on GET, POST, PUT, DELETE - Generate your keys
domain: example.com
records:
- name: "" # Root domain (@)
type: A
target: 1.2.3.4
ttl: 3600
- name: www
type: CNAME
target: example.com.
ttl: 3600
- name: mail
type: MX
target: mail.example.com.
priority: 10
ttl: 3600
- name: _dmarc
type: TXT
target: "v=DMARC1; p=none;"
ttl: 3600ovh-dns-manager export --domain example.com --output config.yamlovh-dns-manager apply --config config.yaml --dry-runovh-dns-manager apply --config config.yamlovh-dns-manager apply --config config.yaml --credentials /path/to/creds.yaml# Export using environment variables
export OVH_APPLICATION_KEY=your_key
export OVH_APPLICATION_SECRET=your_secret
export OVH_CONSUMER_KEY=your_consumer_key
export OVH_DOMAIN=example.com
ovh-dns-manager export
# Apply using environment variables
export OVH_CONFIG_PATH=/path/to/config.yaml
ovh-dns-manager apply --dry-run# Export
podman run --rm -v $(pwd):/data:Z \
-e OVH_APPLICATION_KEY=your_key \
-e OVH_APPLICATION_SECRET=your_secret \
-e OVH_CONSUMER_KEY=your_consumer_key \
-e OVH_DOMAIN=example.com \
ghcr.io/epheo/ovh-dns-manager export --output /data/config.yaml
# Apply
podman run --rm -v $(pwd):/data:Z \
-e OVH_APPLICATION_KEY=your_key \
-e OVH_APPLICATION_SECRET=your_secret \
-e OVH_CONSUMER_KEY=your_consumer_key \
-e OVH_CONFIG_PATH=/data/config.yaml \
ghcr.io/epheo/ovh-dns-manager apply --dry-run# Export
podman run --rm -v $(pwd):/data:Z ghcr.io/epheo/ovh-dns-manager \
export --domain example.com --output /data/config.yaml \
--credentials /data/ovh-credentials.yaml
# Apply
podman run --rm -v $(pwd):/data:Z ghcr.io/epheo/ovh-dns-manager \
apply --config /data/config.yaml \
--credentials /data/ovh-credentials.yamlpodman build -t ovh-dns-manager .
podman run --rm -v $(pwd):/data:Z ovh-dns-manager [commands...]- A - IPv4 address
- AAAA - IPv6 address
- CNAME - Canonical name
- MX - Mail exchanger (priority 0+ allowed)
- TXT - Text record
- NS - Name server
- SRV - Service record (requires priority)
- SPF - Sender Policy Framework
- CAA - Certificate Authority Authorization
- PTR - Pointer record
~16 MB peak (seems stable regardless of records count <100)
| Variable | Description | Default | Required |
|---|---|---|---|
OVH_ENDPOINT |
OVH API endpoint (ovh-eu, ovh-ca, ovh-us) | ovh-eu |
No |
OVH_APPLICATION_KEY |
OVH API application key | - | Yes* |
OVH_APPLICATION_SECRET |
OVH API application secret | - | Yes* |
OVH_CONSUMER_KEY |
OVH API consumer key | - | Yes* |
OVH_TIMEOUT |
API timeout in seconds | 30 |
No |
OVH_DOMAIN |
Domain name (for export command) | - | No |
OVH_CONFIG_PATH |
Path to DNS config YAML file | - | No |
OVH_CREDENTIALS_PATH |
Path to credentials YAML file | ovh-credentials.yaml |
No |
*Required unless provided in YAML file
-
One-time setup: Export existing DNS configuration
ovh-dns-manager export --domain example.com # Or with env vars: export OVH_DOMAIN=example.com ovh-dns-manager export
-
Edit YAML file with desired DNS records
-
Preview changes with dry-run
ovh-dns-manager apply --config example.com.yaml --dry-run # Or with env vars: export OVH_CONFIG_PATH=example.com.yaml ovh-dns-manager apply --dry-run
-
Apply changes
ovh-dns-manager apply --config example.com.yaml
- Validates YAML syntax and DNS record formats
- Handles OVH API rate limits with retries
- Provides detailed error messages for troubleshooting
- Exits with non-zero code on errors
- One-way sync only: Changes are applied from YAML to OVH only
- No backup: Always export current state before major changes
- One domain per file: Each YAML file manages one DNS zone
- No record merging: Duplicate name+type combinations will conflict