feat(cloudflare_ddns_service): migrate role to my fork of the project
This commit is contained in:
parent
34c00ffb82
commit
ef60d1a8e9
11 changed files with 80 additions and 60 deletions
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
# handlers file for cloudflare-ddns
|
|
@ -1,11 +0,0 @@
|
|||
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: []
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
# 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
|
|
@ -1,6 +0,0 @@
|
|||
#!/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
|
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
# vars file for cloudflare-ddns
|
|
@ -1,40 +1,30 @@
|
|||
cloudflare-ddns
|
||||
===============
|
||||
# `jcgruenhage.cloudflare_ddns_service`
|
||||
|
||||
Dynamic DNS using Cloudflare.
|
||||
Dynamic DNS using Cloudflare, running in Docker.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
VoidLinux, as the tool is not packaged for other distros, and installing using cargo isn't supported yet.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
## 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
|
||||
- **cloudflare_ddns_ipv4**: Whether to set v4 record, defaults to true
|
||||
- **cloudflare_ddns_ipv6**: Whether to set v6 record, defaults to false
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
## Example Playbook
|
||||
|
||||
```yaml
|
||||
- hosts: servers
|
||||
collections:
|
||||
- jcgruenhage.base
|
||||
roles:
|
||||
- role: cloudflare-ddns
|
||||
- role: jcgruenhage.base.cloudflare_ddns_service
|
||||
cloudflare_ddns_api_token: your-token-here
|
||||
cloudflare_ddns_zone: example.org
|
||||
cloudflare_ddns_domain: host.example.org
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
## License
|
||||
|
||||
AGPL-3.0-only
|
||||
CNPLv7+
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
## Author Information
|
||||
|
||||
Jan Christian Grünhage <jan.christian@gruenhage.xyz>
|
9
roles/cloudflare_ddns_service/handlers/main.yml
Normal file
9
roles/cloudflare_ddns_service/handlers/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
# handlers file for cloudflare-ddns
|
||||
- name: Restart cloudflare-ddns-service
|
||||
become: true
|
||||
community.docker.docker_container:
|
||||
name: cloudflare-ddns-service
|
||||
restart: true
|
||||
state: started
|
||||
listen: restart-cloudflare-ddns-service
|
11
roles/cloudflare_ddns_service/meta/main.yml
Normal file
11
roles/cloudflare_ddns_service/meta/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
galaxy_info:
|
||||
author: Jan Christian Grünhage
|
||||
description: Cloudflare DDNS service, hosted in a container
|
||||
license: CNPLv7+
|
||||
min_ansible_version: "2.10"
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- bullseye
|
||||
galaxy_tags: []
|
||||
dependencies: []
|
41
roles/cloudflare_ddns_service/tasks/main.yml
Normal file
41
roles/cloudflare_ddns_service/tasks/main.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
# tasks file for cloudflare-ddns
|
||||
- name: Create cloudflare-ddns-service user
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: cloudflare-ddns-service
|
||||
system: true
|
||||
register: cloudflare_ddns_user_result
|
||||
- name: Create config and cache dirs
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ cloudflare_ddns_user_result.name }}"
|
||||
group: "{{ cloudflare_ddns_user_result.group }}"
|
||||
mode: 0700
|
||||
loop:
|
||||
- "/etc/cloudflare-ddns-service"
|
||||
- "/var/cache/cloudflare-ddns-service"
|
||||
- name: Template config file
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
content: "{{ cloudflare_ddns_config | to_nice_yaml }}"
|
||||
dest: /etc/cloudflare-ddns-service/config.yaml
|
||||
owner: "{{ cloudflare_ddns_user_result.name }}"
|
||||
group: "{{ cloudflare_ddns_user_result.group }}"
|
||||
mode: 0600
|
||||
notify: restart-cloudflare-ddns-service
|
||||
- name: Start cloudflare-ddns-service container
|
||||
become: true
|
||||
community.docker.docker_container:
|
||||
name: cloudflare-ddns-service
|
||||
image: git.jcg.re/jcgruenhage/cloudflare-ddns-service:v0.5.1
|
||||
volumes:
|
||||
- "/etc/cloudflare-ddns-service:/etc/cloudflare-ddns-service:ro"
|
||||
- "/var/cache/cloudflare-ddns-service:/var/cache/cloudflare-ddns-service"
|
||||
env:
|
||||
RUST_LOG: INFO
|
||||
user: "{{ cloudflare_ddns_user_result.uid }}:{{ cloudflare_ddns_user_result.group }}"
|
||||
network_mode: host
|
||||
restart_policy: unless-stopped
|
9
roles/cloudflare_ddns_service/vars/main.yml
Normal file
9
roles/cloudflare_ddns_service/vars/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
# vars file for cloudflare-ddns
|
||||
cloudflare_ddns_config:
|
||||
api_token: "{{ cloudflare_ddns_api_token }}"
|
||||
domain: "{{ cloudflare_ddns_domain }}"
|
||||
zone: "{{ cloudflare_ddns_zone }}"
|
||||
ipv4: "{{ cloudflare_ddns_ipv4 | default(true) }}"
|
||||
ipv6: "{{ cloudflare_ddns_ipv6 | default(false) }}"
|
||||
interval: 15
|
Loading…
Reference in a new issue