Add DNS records to Cloudflare automatically

This replaces the custom solution where the records were
added manually in pi-hole.
This commit is contained in:
Thomas Kleinendorst 2024-12-25 17:23:35 +01:00
parent de2b39097a
commit 1969af9a01
2 changed files with 24 additions and 20 deletions

View file

@ -11,8 +11,10 @@
dest: "/etc/nginx/conf.d/{{ simple_reverse_proxy_internal_subdomain }}.conf"
mode: '0644'
notify: Restart Nginx
- name: Debug
ansible.builtin.debug:
msg: >-
Don't forget to manually add a DNS record for {{ simple_reverse_proxy_internal_subdomain }}.kleinendorst.info
pointing to: {{ ansible_facts['default_ipv4']['address'] }}.
- name: Add DNS record in Cloudflare
community.general.cloudflare_dns:
domain: kleinendorst.info
record: "{{ simple_reverse_proxy_internal_subdomain }}"
type: A
value: "{{ ansible_facts['default_ipv4']['address'] }}"
api_token: "{{ dns_cloudflare_token }}"