fix(cloudflare_dns): prefer CLOUDFLARE_API_TOKEN over CLOUDFLARE_DNS_API_TOKEN

Align the DNS role's token resolution with the rest of the stack, which
exports the generic CLOUDFLARE_API_TOKEN. The dedicated *_DNS_API_TOKEN now
acts as the fallback, both for play vars and the environment lookup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Haitao Pan 2026-06-27 11:31:08 +08:00
parent 9b59c89d80
commit 5c74feb860

View File

@ -11,8 +11,8 @@
ansible.builtin.set_fact:
cloudflare_dns_api_token: >-
{{
vars.get('CLOUDFLARE_DNS_API_TOKEN', '')
| default(vars.get('CLOUDFLARE_API_TOKEN', ''), true)
vars.get('CLOUDFLARE_API_TOKEN', '')
| default(vars.get('CLOUDFLARE_DNS_API_TOKEN', ''), true)
}}
when: cloudflare_dns_api_token | default('', true) | length == 0
@ -20,8 +20,8 @@
ansible.builtin.set_fact:
cloudflare_dns_api_token: >-
{{
lookup('ansible.builtin.env', 'CLOUDFLARE_DNS_API_TOKEN')
| default(lookup('ansible.builtin.env', 'CLOUDFLARE_API_TOKEN'), true)
lookup('ansible.builtin.env', 'CLOUDFLARE_API_TOKEN')
| default(lookup('ansible.builtin.env', 'CLOUDFLARE_DNS_API_TOKEN'), true)
}}
when: cloudflare_dns_api_token | default('', true) | length == 0