Skip to content

Commit

Permalink
Some fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
rbo committed Dec 16, 2022
1 parent 6b1a4bf commit 6e623d9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ansible/roles/public_dns/tasks/create-cloudflare.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Create Cloudflare DNS records via account_api_token
cloudflare_dns:
community.general.cloudflare_dns:
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
# 1 is auto
Expand All @@ -22,7 +22,7 @@


- name: Create IPv6 Cloudflare DNS records via account_api_token
cloudflare_dns:
community.general.cloudflare_dns:
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
# 1 is auto
Expand All @@ -43,7 +43,7 @@
- cloudflare_account_api_token is defined

- name: Create Cloudflare DNS records via api_token
cloudflare_dns:
community.general.cloudflare_dns:
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
# 1 is auto
Expand All @@ -62,7 +62,7 @@
- cloudflare_api_token is defined

- name: Create IPv6 Cloudflare DNS records via api_token
cloudflare_dns:
community.general.cloudflare_dns:
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
# 1 is auto
Expand Down
44 changes: 40 additions & 4 deletions ansible/roles/public_dns/tasks/destroy-cloudflare.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

- name: Delete DNS record at CloudFlare via account_api_token
cloudflare_dns:
community.general.cloudflare_dns:
state: absent
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
Expand All @@ -14,9 +13,12 @@
with_items:
- api
- '*.apps'
when:
- cloudflare_account_email is defined
- cloudflare_account_api_token is defined

- name: Delete IPv6 DNS record at CloudFlare via account_api_token
cloudflare_dns:
community.general.cloudflare_dns:
state: absent
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
Expand All @@ -29,4 +31,38 @@
with_items:
- api
- '*.apps'
when: (pd_public_ipv6 is defined) and (pd_public_ipv6|length > 0)
when:
- cloudflare_account_email is defined
- cloudflare_account_api_token is defined

- name: Delete DNS record at CloudFlare via api_token
community.general.cloudflare_dns:
state: absent
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
# 1 is auto
ttl: 1
type: A
value: "{{ pd_public_ip }}"
api_token: "{{ cloudflare_api_token }}"
with_items:
- api
- '*.apps'
when:
- cloudflare_api_token is defined

- name: Delete IPv6 DNS record at CloudFlare via api_token
community.general.cloudflare_dns:
state: absent
zone: "{{ pd_cloudflare_zone }}"
record: "{{ item }}.{{ pd_public_domain }}"
# 1 is auto
ttl: 1
type: AAAA
value: "{{ pd_public_ipv6 }}"
api_token: "{{ cloudflare_api_token }}"
with_items:
- api
- '*.apps'
when:
- cloudflare_api_token is defined

0 comments on commit 6e623d9

Please sign in to comment.