Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/common/validate_inputs.yml

raw symbols SCIP
1 ---
2 - name: Validate when custom iso if false
3 when: source.is_custom_iso is undefined or source.is_custom_iso is false
4 block:
5 - name: Validate the OS Name and OS version is provided
6 when: os_name is undefined or os_version is undefined
7 ansible.builtin.fail:
8 msg: "{{ idrac_os_deployment_err_msg_os_required }}"
9
10 - name: Validate the OS Name and OS version
11 when: (os_name | upper not in idrac_os_deployment_supported_os.keys()) or
12 ((os_version | string | split('.') | first) not in idrac_os_deployment_supported_os[os_name | upper])
13 ansible.builtin.fail:
14 msg: "{{ idrac_os_deployment_err_msg_unsupported_os | format(os_name, os_version) }}"
15
16 - name: Check if root password exists
17 when:
18 - source.ks_path is undefined
19 - ((os_name | upper == 'RHEL') and (rhel_rootpw | length == 0)) or
20 ((os_name | upper == 'ESXI') and (esxi_rootpw | length == 0))
21 ansible.builtin.fail:
22 msg: "{{ idrac_os_deployment_err_msg_root_password | format(os_name) }}"
23
24 - name: Check if the template file Exists
25 when: source.ks_path is undefined
26 block:
27 - name: Check if the template file exists
28 register: idrac_os_deployment_template_file
29 delegate_to: "{{ idrac_os_deployment_delegate }}"
30 ansible.builtin.stat:
31 path: "{{ role_path }}/templates/{{ os_name | upper }}_{{ os_version | string | split('.') | first }}.j2"
32
33 - name: Fail if the Template file doesn't exists
34 when: not idrac_os_deployment_template_file.stat.exists
35 ansible.builtin.fail:
36 msg: "{{ idrac_os_deployment_err_msg_template | format(os_name | upper, os_version) }}"
37
38 - name: Validate destination required when custom iso is an input
39 when: destination is not defined
40 ansible.builtin.fail:
41 msg: "{{ idrac_os_deployment_err_msg_destination_required }}"
42
43 - name: Validate destination iso_name is not empty if provided
44 when:
45 - (destination is defined and destination.iso_name is defined and destination.iso_name == "")
46 ansible.builtin.fail:
47 msg: "{{ idrac_os_deployment_err_msg_destination_iso_name }}"
48
49 - name: Validate destination mountpath folder exists
50 delegate_to: "{{ idrac_os_deployment_delegate }}"
51 when: destination is defined and destination.protocol in ['cifs','nfs']
52 block:
53 - name: Validate destination mountpath
54 register: idrac_os_deployment_mountpoint_folder
55 ansible.builtin.stat:
56 path: "{{ destination.mountpoint }}"
57
58 - name: Fail if the mountpoint destination doesn't exists
59 when: not idrac_os_deployment_mountpoint_folder.stat.exists
60 ansible.builtin.fail:
61 msg: "{{ idrac_os_deployment_err_msg_mountpoint_folder | format(destination.mountpoint) }}"
62
63 - name: Validate when source is local custom iso is not true
64 when:
65 - (source.is_custom_iso is defined and source.is_custom_iso is true) and (source.protocol == "local")
66 ansible.builtin.fail:
67 msg: "{{ idrac_os_deployment_err_msg_custom_iso_local }}"
68
69 - name: Validate hostname requirement for source
70 when:
71 - (source.hostname is undefined or source.hostname == "")
72 - (source.is_custom_iso is defined and source.is_custom_iso is true) or (source.protocol in ['http', 'https'])
73 ansible.builtin.fail:
74 msg: "{{ idrac_os_deployment_err_msg_hostname_required }}"