homelab-automation/Ansible/roles/cloudflare-dns.yml
Benjamin Hays 6b208a768a
Some checks failed
Ansible Deploy / deploy (Ansible/playbooks/debian.yml) (push) Successful in 1m40s
Ansible Deploy / deploy (Ansible/playbooks/proxmox.yml) (push) Successful in 3m11s
Ansible Lint / build (push) Failing after 1m12s
Add new hosts and fix some ansible semantics
2024-11-28 16:40:45 -05:00

33 lines
944 B
YAML

---
- name: Copy Cloudflare IPAM Script
ansible.builtin.copy:
owner: bhays
mode: "0700"
src: ../../Scripts/cloudflare-dns.sh
dest: /opt/cloudflare-dns.sh
changed_when: false
- name: Insert API Token
ansible.builtin.replace:
path: "/opt/cloudflare-dns.sh"
regexp: "^cloudflare_zone_api_token=''"
replace: "cloudflare_zone_api_token='{{ CF_API_TOKEN }}'"
changed_when: false
- name: Insert Zone ID
ansible.builtin.replace:
path: "/opt/cloudflare-dns.sh"
regexp: "^zoneid=''"
replace: "zoneid='{{ CF_ZONE_ID }}'"
changed_when: false
- name: Insert DNS Record
ansible.builtin.replace:
path: "/opt/cloudflare-dns.sh"
regexp: "^dns_record=''"
replace: "dns_record='{{ inventory_hostname }}'"
changed_when: false
- name: Add Cronjob for IPAM Script
ansible.builtin.cron:
name: "Cloudflare IPAM Script"
job: "/opt/cloudflare-dns.sh"
special_time: hourly
user: bhays