Compare commits

...

1 Commits

Author SHA1 Message Date
Jan Christian Grünhage cc671bda63
feat(cloudflare-ddns): add cloudflare-ddns role 2021-01-15 12:56:45 +01:00
7 changed files with 82 additions and 0 deletions

View 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>

View File

@ -0,0 +1,2 @@
---
# defaults file for cloudflare-ddns

View File

@ -0,0 +1,2 @@
---
# handlers file for cloudflare-ddns

View 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: []

View 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

View 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

View File

@ -0,0 +1,2 @@
---
# vars file for cloudflare-ddns