fix(acme): restore no_log and switch to command+environment for credential safety

Re-adds no_log: true removed in 5e4e17e and switches the issue task from
ansible.builtin.shell with inline VAR=value to ansible.builtin.command with
an environment: dict. This prevents credentials appearing in Ansible failure
output and avoids the inline env var being clobbered when acme.sh sources
account.conf internally before the dns_namecom plugin runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chrisfu 2026-05-06 15:27:44 -04:00
parent 5e4e17ec60
commit 18f2ce2167

View File

@ -59,20 +59,22 @@
no_log: true no_log: true
- name: Issue certs via DNS-01 (name.com) — skip if already issued - name: Issue certs via DNS-01 (name.com) — skip if already issued
ansible.builtin.shell: | ansible.builtin.command: >-
NAMECOM_Username="{{ acme_namecom_username }}" \ {{ acme_install_dir }}/acme.sh --issue
NAMECOM_Token="{{ acme_namecom_token }}" \ --dns dns_namecom
{{ acme_install_dir }}/acme.sh --issue \ -d {{ item.domain }}
--dns dns_namecom \ --home {{ acme_install_dir }}
-d {{ item.domain }} \
--home {{ acme_install_dir }} \
--server letsencrypt --server letsencrypt
environment:
NAMECOM_Username: "{{ acme_namecom_username }}"
NAMECOM_Token: "{{ acme_namecom_token }}"
loop: "{{ acme_certs }}" loop: "{{ acme_certs }}"
register: acme_issue register: acme_issue
changed_when: "'Cert success' in acme_issue.stdout" changed_when: "'Cert success' in acme_issue.stdout"
# rc=2 means cert already exists and is not due for renewal — treat as ok # rc=2 means cert already exists and is not due for renewal — treat as ok
failed_when: acme_issue.rc not in [0, 2] failed_when: acme_issue.rc not in [0, 2]
when: item.domain not in acme_list.stdout when: item.domain not in acme_list.stdout
no_log: true
- name: Install cert files to target paths - name: Install cert files to target paths
ansible.builtin.command: >- ansible.builtin.command: >-