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.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
---
|
||||
- name: Extract any absolute krb5.conf path from provision output
|
||||
- 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')
|
||||
| first) | default('', true) }}
|
||||
| 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
|
||||
|
||||
Reference in New Issue
Block a user