You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
1 year ago | |
---|---|---|
plugins | 1 year ago | |
tests | 1 year ago | |
COPYING | 1 year ago | |
Makefile | 2 years ago | |
README.md | 1 year ago | |
galaxy.yml | 1 year ago |
README.md
hetzner dns ansible collection
Manage DNS records using ansible. E.g. set DNS records while creating servers in the same play.
- https://galaxy.ansible.com/markuman/hetzner_dns
ansible-galaxy collection install markuman.hetzner_dns
Auth
The API token can be set via ansible parameter or ENV variable.
Ansible Parameter | ENV Variable |
---|---|
api_token |
HETZNER_DNS_TOKEN |
All modules supports and respects check_mode: yes
.
record
state: absent
- deleting a record:
name
andtype
are sufficient (value
andttl
doesn't matter).
- deleting a record:
state: present
- the
ttl
default value is set to0
(same as hetzner webinterface did.) - Either
zone_id
orzone_name
must be given, but not both.
- the
parameters | default | comment |
---|---|---|
name |
- | name of a record |
value |
- | required with state: present |
type |
- | type of record. valid records: "A" "AAAA" "NS" "MX" "CNAME" "RP" "TXT" "SOA" "HINFO" "SRV" "DANE" "TLSA" "DS" "CAA" |
ttl |
300 |
TTL of a record |
zone_id |
- | Required one of zone_name or zone_id |
zone_name |
- | Required one of zone_name or zone_id |
api_token |
- | Can be also set as env variable HETZNER_DNS_TOKEN |
- name: add record
markuman.hetzner_dns.record:
zone_name: osuv.de
name: hetzner_dns_ansible_collection
value: osuv.de.
type: CNAME
ttl: 300
register: RECORD
- name: add record no change
markuman.hetzner_dns.record:
zone_name: osuv.de
name: hetzner_dns_ansible_collection
value: osuv.de.
type: CNAME
ttl: 300
register: RECORD
- name: add record change
markuman.hetzner_dns.record:
zone_name: osuv.de
name: hetzner_dns_ansible_collection
value: osuv.de.
type: CNAME
ttl: 60
register: RECORD
- name: del record
markuman.hetzner_dns.record:
zone_name: osuv.de
name: hetzner_dns_ansible_collection
type: CNAME
state: absent
register: RECORD
mx priority
When dialing with sevaral mx records, the priority must be part of the value.
- name: take care about mx record
markuman.hetzner_dns.record:
api_token: "{{ API }}"
zone_name: osuv.de
name: "@"
value: 10 mail.osuv.de.
type: MX
ttl: 300
register: RECORD
record_info
When no filter is given, all records will be returned.
Either zone_id
or zone_name
must be given, but not both.
Parameter filter
must be a list, where each object supports the same keys as in record
module for search.
parameter | default | comments |
---|---|---|
filter |
- | Apply a list of key/value pairs to search for |
zone_id |
- | Required one of zone_name or zone_id |
zone_name |
- | Required one of zone_name or zone_id |
api_token |
- | Can be also set as env variable HETZNER_DNS_TOKEN |
- name: fetch zone info
markuman.hetzner_dns.record_info:
filter:
- name: fritzbox
value: 192.168.178.1
type: A
- name: fritzbox
type: AAAA
zone_name: osuv.de
zone_info
To determine the zone_id
.
- name: fetch zone info
markuman.hetzner_dns.zone_info:
name: zone_name
SCM
host | category |
---|---|
https://git.osuv.de/m/hetzner_dns | origin |
https://gitlab.com/markuman/hetzner_dns | pull mirror, issues, MR |
https://github.com/markuman/hetzner_dns | push mirror, issues, PR |
License
GNU General Public License v3.0+
Basically I don't care about the license in this case. So I've decided to choose the same license as official Ansible Hetzner Cloud Collection.