ansible-role-cloudflare-ddns/README.md

91 lines
2.2 KiB
Markdown
Raw Normal View History

2022-08-23 10:45:57 +02:00
Role Name
=========
**cloudflare-ddns** - Install cloudflare DDNS docker image.
2022-08-23 10:45:57 +02:00
This role helps you push your public IP address on Cloudflare DNS, so your self-hosted sites can be accessed.
2022-08-23 10:45:57 +02:00
Role Variables
--------------
This role uses the variables listed below, along with default values (see defaults/main.yml).
You can specify the docker container name and the image version to be used. You can also specify the docker volume where the container should store its relevant data
```yml
dns_container_name: "cloudflare-dns"
dns_image_version: "latest"
dns_volume_config: "/tmp"
```
The `dns_domains` variable contains credentials and domain definitions. Credentials are specified like so:
```yaml
dns_domains:
auth:
scopedToken: QPExdfoNLwndJPDbt4nK1-yF1z_srC8D0m6-Gv_h
```
This role allows you to set up DDNS for multiple domains:
```yaml
dns_domains:
domains:
- name: foo.example.com
type: A
proxied: true
create: true
zoneId: JBFRZWzhTKtRFWgu3X7f3YLX
- name: bar.example.com
type: A
proxied: true
create: true
zoneId: JBFRZWzhTKtRFWgu3X7f3YLY
```
All items declared into `dns_domains` are converted to the necessary configuration file via the *config.yaml.j2* template.
If you want more details on which parameters you can add to `dns_domains`, please see the [container's documentation](https://hub.docker.com/r/oznu/cloudflare-ddns/#!)
2022-08-23 10:45:57 +02:00
Example Playbook
----------------
You can see a full example (with dummy vars too!) below. It configures two sub-domains as A records:
```yaml
- hosts: servers
vars:
dns_container_name: "cloudflare-dns"
dns_image_version: "latest"
dns_volume_config: "/tmp"
dns_domains:
auth:
scopedToken: QPExdfoNLwndJPDbt4nK1-yF1z_srC8D0m6-Gv_h
domains:
- name: foo.example.com
type: A
proxied: true
create: true
zoneId: JBFRZWzhTKtRFWgu3X7f3YLX
- name: bar.example.com
type: A
proxied: true
create: true
zoneId: JBFRZWzhTKtRFWgu3X7f3YLY
roles:
- 'laurivan.cloudflare_ddns'
```
2022-08-23 10:45:57 +02:00
License
-------
MIT
2022-08-23 10:45:57 +02:00
Author Information
------------------
This role was created in 2022 by [Laur Ivan](https://www.laurivan.com).