From 5c74feb86042b120a19b094916bd3273ef56def4 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Sat, 27 Jun 2026 11:31:08 +0800 Subject: [PATCH] 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 --- roles/cloudflare_dns/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/cloudflare_dns/tasks/main.yml b/roles/cloudflare_dns/tasks/main.yml index 8a2d22e..f5fa007 100644 --- a/roles/cloudflare_dns/tasks/main.yml +++ b/roles/cloudflare_dns/tasks/main.yml @@ -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