feat(cloudflare-ddns): add cloudflare-ddns role
This commit is contained in:
parent
0fb3517ec6
commit
cc671bda63
7 changed files with 82 additions and 0 deletions
40
roles/cloudflare-ddns/README.md
Normal file
40
roles/cloudflare-ddns/README.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
cloudflare-ddns
|
||||
===============
|
||||
|
||||
Dynamic DNS using Cloudflare.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
VoidLinux, as the tool is not packaged for other distros, and installing using cargo isn't supported yet.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
- **cloudflare_ddns_api_token**: API token with access to the zone
|
||||
- **cloudflare_ddns_domain**: Domain for which to update the record
|
||||
- **cloudflare_ddns_zone**: Zone which contains the domain
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
```yaml
|
||||
- hosts: servers
|
||||
collections:
|
||||
- jcgruenhage.base
|
||||
roles:
|
||||
- role: cloudflare-ddns
|
||||
cloudflare_ddns_api_token: your-token-here
|
||||
cloudflare_ddns_zone: example.org
|
||||
cloudflare_ddns_domain: host.example.org
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
AGPL-3.0-only
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Jan Christian Grünhage <jan.christian@gruenhage.xyz>
|
2
roles/cloudflare-ddns/defaults/main.yml
Normal file
2
roles/cloudflare-ddns/defaults/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# defaults file for cloudflare-ddns
|
2
roles/cloudflare-ddns/handlers/main.yml
Normal file
2
roles/cloudflare-ddns/handlers/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# handlers file for cloudflare-ddns
|
11
roles/cloudflare-ddns/meta/main.yml
Normal file
11
roles/cloudflare-ddns/meta/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
galaxy_info:
|
||||
author: Jan Christian Grünhage
|
||||
description: Cloudflare DDNS tool
|
||||
license: AGPL-3.0-only
|
||||
min_ansible_version: 2.10
|
||||
platforms:
|
||||
- name: VoidLinux
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags: []
|
||||
dependencies: []
|
19
roles/cloudflare-ddns/tasks/main.yml
Normal file
19
roles/cloudflare-ddns/tasks/main.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
# tasks file for cloudflare-ddns
|
||||
- name: install cloudflare-ddns package
|
||||
become: true
|
||||
xbps:
|
||||
name: cloudflare-ddns
|
||||
state: present
|
||||
- name: template wrapper script
|
||||
become: true
|
||||
no_log: true
|
||||
template:
|
||||
src: wrapper.sh.j2
|
||||
dest: /usr/local/bin/cloudflare-ddns-wrapper.sh
|
||||
mode: 755
|
||||
- name: add cron job
|
||||
become: true
|
||||
cron:
|
||||
name: cloudflare-ddns
|
||||
job: /usr/local/bin/cloudflare-ddns-wrapper.sh
|
6
roles/cloudflare-ddns/templates/wrapper.sh.j2
Normal file
6
roles/cloudflare-ddns/templates/wrapper.sh.j2
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
exec /usr/bin/cloudflare-ddns \
|
||||
--token {{ cloudflare_ddns_api_token }} \
|
||||
--domain {{ cloudflare_ddns_domain }} \
|
||||
--zone {{ cloudflare_ddns_zone }} \
|
||||
--cache /tmp/cloudflare-ddns-ip-cache
|
2
roles/cloudflare-ddns/vars/main.yml
Normal file
2
roles/cloudflare-ddns/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# vars file for cloudflare-ddns
|
Loading…
Reference in a new issue