Files
ansible_samba_ad_dc/tasks/kerberos.yml
Jose 9cad7d3b64 style 💎: Update regex search for krb5_conf_path
Updated the regex search pattern in the `krb5_conf_path` fact to ensure a list is returned even if no match is found, and added default values for clarity.
2025-11-05 21:37:57 +01:00

20 lines
686 B
YAML

---
- name: Extract absolute krb5.conf path from provision output
ansible.builtin.set_fact:
krb5_conf_path: >-
{{ (samba_provision_output.stdout
| regex_search('(/[^\\s]+/krb5\\.conf)', '\\1')
| default([]) # ensures a list even if no match
| first # safely takes the first match
) | default('', true) }}
when: samba_provision_output.stdout is defined
- name: Copy krb5.conf to /etc/krb5.conf
ansible.builtin.copy:
src: '{{ krb5_conf_path }}'
dest: /etc/krb5.conf
owner: root
group: root
mode: '0644'
# Only run this if the provision was successful (changed)
when: samba_provision_output.changed