Raspberry-Pi-IaC/roles/simple-reverse-proxy/tasks/main.yml
Thomas Kleinendorst 1969af9a01 Add DNS records to Cloudflare automatically
This replaces the custom solution where the records were
added manually in pi-hole.
2024-12-25 17:23:35 +01:00

20 lines
888 B
YAML

---
- name: "Install certificate for {{ simple_reverse_proxy_internal_subdomain }}.kleinendorst.info"
become: true
ansible.builtin.command:
cmd: "register_certbot_domain.sh {{ simple_reverse_proxy_internal_subdomain }}.kleinendorst.info"
creates: "/etc/letsencrypt/live/{{ simple_reverse_proxy_internal_subdomain }}.kleinendorst.info" # The certificate directory
- name: Set Nginx configuration
become: true
ansible.builtin.template:
src: nginx-configuration.conf.j2
dest: "/etc/nginx/conf.d/{{ simple_reverse_proxy_internal_subdomain }}.conf"
mode: '0644'
notify: Restart Nginx
- 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 }}"