Updated the regular expression to correctly extract the absolute path of the krb5.conf file from the samba provision output. This change ensures that the extracted path is properly formatted and can be used in subsequent tasks.
26 lines
791 B
YAML
26 lines
791 B
YAML
---
|
|
- name: Extract absolute krb5.conf path from provision output
|
|
ansible.builtin.set_fact:
|
|
krb5_conf_path: >-
|
|
{{ (
|
|
samba_provision_output.stdout
|
|
| regex_findall("(/[^\\s,'\"]+krb5\\.conf)")
|
|
| default([])
|
|
| first
|
|
| default('')
|
|
) | replace(\"'\", '') | replace('\"', '') | replace(',', '') | trim }}
|
|
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 |