feat(pb,role,task): makes VM deployment playbook use new validation pre_tasks, become_method and os_template tasks are shared now
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
---
|
||||
|
||||
- name: Set default become method
|
||||
ansible.builtin.set_fact:
|
||||
guest_become_method: "sudo"
|
||||
|
||||
- name: Prompt for become method with immediate validation
|
||||
ansible.builtin.pause:
|
||||
prompt: "Choose become method, available: sudo, su, pbrun, pfexec, doas, dzdo, ksu, runas, machinectl [sudo]"
|
||||
register: become_method_result
|
||||
until: >
|
||||
become_method_result.user_input | length == 0 or
|
||||
(
|
||||
become_method_result.user_input in ['sudo', 'su', 'pbrun', 'pfexec', 'doas', 'dzdo', 'ksu', 'runas', 'machinectl']
|
||||
)
|
||||
retries: 2
|
||||
delay: 0
|
||||
|
||||
- name: Use user input only if provided, otherwise keep the default
|
||||
ansible.builtin.set_fact:
|
||||
guest_become_method: "{{ become_method_result.user_input }}"
|
||||
when: become_method_result.user_input | length > 0
|
||||
Reference in New Issue
Block a user