https://github.com/jamesob/gandi-ddns
Declarative dynamic DNS with gandi.net
https://github.com/jamesob/gandi-ddns
ddns dns dynamic-dns gandi gandi-api gandi-dns no-dependencies
Last synced: 10 months ago
JSON representation
Declarative dynamic DNS with gandi.net
- Host: GitHub
- URL: https://github.com/jamesob/gandi-ddns
- Owner: jamesob
- Created: 2022-09-14T15:52:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-14T19:10:39.000Z (over 3 years ago)
- Last Synced: 2025-01-15T14:43:04.962Z (over 1 year ago)
- Topics: ddns, dns, dynamic-dns, gandi, gandi-api, gandi-dns, no-dependencies
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gandi-ddns
A dependency-less script for declarative dynamic DNS using the gandi.net API.
**Requires**: Python 3.10+
## Example configuration
The following locations will be searched for a configuration file (or you can
specify the `--conf` argument):
- environment variable `GANDI_DDNS_CONFIG`
- ~/.config/gandi-ddns.ini
- /etc/gandi-ddns/config.ini
```ini
[default]
# Required
wan_device = enp2s0
gandi_api_key = $GANDI_API_KEY
# Optional; called when record changes happen or fail. Takes a single arg, a string
# message. I use pushover.net for this.
notify_script = /usr/local/bin/pushover
# Each domain has its own section. Within each section, the format is
#
# [record type], [record name] = [record value], ...
#
[foobar.org]
# blank value will be filled in with running host's IP.
A, @
A, mail
CNAME, bmon = some-host.lan.
# values are CSVs for separate records with the same name.
MX, @ = 10 one-val.com., 20 other-val.com.
[hmmmm.com]
A, @
```
## Environment variables
- `GANDI_APIKEY`: API key for gandi.net
- `GANDI_DDNS_CONFIG`: path to configuration file
## Install
```sh
% curl $this_url/main.py > ~/.local/bin/gandi-ddns # or wherever
% chmod +x ~/.local/bin/gandi-ddns
% $EDITOR ~/.config/gandi-ddns.conf
% gandi-ddns
```
Run it on a crontab if you want:
```sh
% cat /etc/cron.d/gandi-ddns
*/15 * * * * your-user /home/your-user/.local/bin/gandi-ddns
```