- Install selectel-dns-api:
pip install selectel-dns-api
- Copy selectel_dns.py to your modules directory
- Add modules directory to ansible.cfg (
library = path/to/modules
)
Replace ansible-selectel-dns.ru and селектел-днс-тест.рф to your domains.
bash test.sh
Inspired by dnsimple module.
Documentation generated with jedelman8/ansible-webdocs.
Using in viasite-ansible.site.
- selecte-dns-api
Interface with Selectel DNS hosting.
- Synopsis
- Options
- Examples
Manages domains and records via the Selectel DNS API, see the docs: U(https://my.selectel.ru/domains/doc)
Parameter | required | default | choices | comments |
---|---|---|---|---|
solo | no | Whether the record should be the only one for that record type and record name. Only use with state=present on a record | ||
domain | no | Domain to work with. Can be the domain name (e.g. "mydomain.com") or the numeric ID of the domain in Selectel. If omitted, a list of domains will be returned. If domain is present but the domain doesn't exist, it will be created. | ||
ttl | no | 3600 (one hour) | The TTL to give the new record | |
value | no | Record value Must be specified when trying to ensure a record exists | ||
priority | no | Record priority | ||
record | no | Record to add, if blank a record for the domain will be created, supports the wildcard (*) | ||
state | no |
|
whether the record should exist or not | |
api_token | no | Account API token. If omitted, the env variable SELECTEL_API_TOKEN will be looked for. | ||
type | no |
|
The type of DNS record to create |
# create domain
- selectel_dns:
domain: my.com
state: present
delegate_to: localhost
# delete a domain
- selectel_dns:
domain: my.com
state: absent
delegate_to: localhost
# create a test.my.com A record to point to 127.0.0.01
- selectel_dns:
domain: my.com
record: test
type: A
value: 127.0.0.1
delegate_to: localhost
# create a my.com CNAME record to example.com
- selectel_dns
domain: my.com
record: ''
type: CNAME
value: example.com
state: present
delegate_to: localhost
# change it's ttl
- selectel_dns:
domain: my.com
record: ''
type: CNAME
value: example.com
ttl: 600
state: present
delegate_to: localhost
# and delete the record
- selectel_dns:
domain: my.com
record: ''
type: CNAME
value: example.com
state: absent
delegate_to: localhost