-
-
Notifications
You must be signed in to change notification settings - Fork 491
/
main.yml
38 lines (34 loc) · 1.33 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
- name: Start Cloudflare DDNS
block:
- name: Check for deprecated API key
ansible.builtin.fail:
msg: "Using a Cloudflare global API key is no longer supported. Please unset cloudflare_api_key and set cloudflare_token"
when: cloudflare_api_key is defined
- name: Create cloudflare Dynamic DNS Directories
ansible.builtin.file:
path: "{{ cloudflare_data_directory }}"
state: directory
- name: Template Cloudflare Dynamic DNS config.yml with scoped token
ansible.builtin.template:
src: config.yml
dest: "{{ cloudflare_data_directory }}/config.yml"
register: template_files_result
- name: Cloudflare Dynamic DNS Container
community.docker.docker_container:
name: "{{ cloudflare_container_name }}"
image: joshava/cloudflare-ddns:latest
pull: true
volumes:
- "{{ cloudflare_data_directory }}/config.yml:/app/config.yaml"
restart_policy: unless-stopped
memory: "{{ cloudflare_memory }}"
recreate: "{{ template_files_result is changed }}"
when: cloudflare_ddns_enabled is true
- name: Stop Cloudflare DDNS
block:
- name: Stop Cloudflare DDNS
community.docker.docker_container:
name: "{{ cloudflare_container_name }}"
state: absent
when: cloudflare_ddns_enabled is false