Files
kevinveenbirkenbachandClaude Opus 4.8 1a643fe000 fix(sys-front-tls-letsencrypt): resolve cert/tls via want-path
Nested-attr access on the lazy vars-lookup dict (_cert.files.cert, _tls.domains.primary) raises under Ansible 2.19+. Use the want-path lookup form so the vars hold resolved scalars.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 21:23:38 +02:00

51 lines
1.5 KiB
YAML

---
# nocheck: run-once
- name: "🔴 Disable self-signed environment"
include_tasks: "{{ lookup('path_absolute', 'roles/sys-ca-selfsigned/tasks/disable_env.yml') }}"
- name: "✅ TLS | (letsencrypt) assert mode is letsencrypt"
ansible.builtin.assert:
that:
- _tls_enabled | bool
- _tls_mode == 'letsencrypt'
fail_msg: >-
sys-front-tls-letsencrypt called for '{{ application_id }}'
but resolver returned enabled={{ _tls_enabled }}, mode={{ _tls_mode }}.
changed_when: false
- name: "🔎 TLS | (letsencrypt) check cert files exist"
ansible.builtin.stat:
path: "{{ item }}"
register: _le_stat
loop:
- "{{ _cert_file }}"
- "{{ _cert_key }}"
changed_when: false
- name: "📜 TLS | (letsencrypt) issue cert if missing"
ansible.builtin.include_role:
name: sys-svc-certs
vars:
domain: "{{ _tls_domain }}"
when: >
(not _le_stat.results[0].stat.exists | default(false)) or
(not _le_stat.results[1].stat.exists | default(false))
- name: "🔎 TLS | (letsencrypt) re-check cert files exist"
ansible.builtin.stat:
path: "{{ item }}"
register: _le_stat2
loop:
- "{{ _cert_file }}"
- "{{ _cert_key }}"
changed_when: false
- name: "🛑 TLS | (letsencrypt) fail if still missing"
ansible.builtin.fail:
msg: >-
Let's Encrypt certificate files not found after issuance:
cert={{ _cert_file }} key={{ _cert_key }}
when: >
(not _le_stat2.results[0].stat.exists | default(false)) or
(not _le_stat2.results[1].stat.exists | default(false))