2025-09-30 17:40:18 +02:00
|
|
|
---
|
2025-11-05 21:37:57 +01:00
|
|
|
- name: Extract absolute krb5.conf path from provision output
|
2025-10-19 22:25:19 +02:00
|
|
|
ansible.builtin.set_fact:
|
2025-11-05 21:01:14 +01:00
|
|
|
krb5_conf_path: >-
|
2025-11-05 22:20:09 +01:00
|
|
|
{{ (your_string_variable
|
2025-11-05 22:36:19 +01:00
|
|
|
| regex_search(r"(/\S*krb5\.conf)", "\\1")
|
2025-11-05 21:37:57 +01:00
|
|
|
| default([]) # ensures a list even if no match
|
2025-11-05 22:20:09 +01:00
|
|
|
| first # safely take the first match
|
2025-11-05 21:37:57 +01:00
|
|
|
) | default('', true) }}
|
2025-10-19 22:25:19 +02:00
|
|
|
when: samba_provision_output.stdout is defined
|
|
|
|
|
|
2025-11-05 21:46:42 +01:00
|
|
|
- name: print krb5.conf path
|
|
|
|
|
ansible.builtin.debug:
|
|
|
|
|
msg: "Krb5.conf path: {{ krb5_conf_path }}"
|
|
|
|
|
|
2025-10-19 22:25:19 +02:00
|
|
|
- name: Copy krb5.conf to /etc/krb5.conf
|
|
|
|
|
ansible.builtin.copy:
|
2025-11-04 19:22:07 +01:00
|
|
|
src: '{{ krb5_conf_path }}'
|
2025-09-30 17:40:18 +02:00
|
|
|
dest: /etc/krb5.conf
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0644'
|
2025-10-19 22:25:19 +02:00
|
|
|
# Only run this if the provision was successful (changed)
|
|
|
|
|
when: samba_provision_output.changed
|