Files
ansible_samba_ad_dc/tasks/kerberos.yml
Jose bb99d469fe style 💎: Improve regex pattern for finding krb5.conf path
Updated the regex pattern to correctly extract the krb5.conf path from the `your_string_variable` value, ensuring a more reliable and consistent configuration setup.
2025-11-05 22:36:19 +01:00

24 lines
774 B
YAML

---
- name: Extract absolute krb5.conf path from provision output
ansible.builtin.set_fact:
krb5_conf_path: >-
{{ (your_string_variable
| regex_search(r"(/\S*krb5\.conf)", "\\1")
| default([]) # ensures a list even if no match
| first # safely take the first match
) | default('', true) }}
when: samba_provision_output.stdout is defined
- name: print krb5.conf path
ansible.builtin.debug:
msg: "Krb5.conf path: {{ krb5_conf_path }}"
- 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