validate_provision_vars.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Convert timezone.txt to linux format
  16. command: dos2unix {{ role_path }}/files/timezone.txt
  17. failed_when: false
  18. changed_when: false
  19. - name: Searching for timezone
  20. lineinfile:
  21. path: "{{ role_path }}/files/timezone.txt"
  22. line: "{{ timezone }}"
  23. state: present
  24. check_mode: yes
  25. register: timezone_search
  26. - name: Assert timezone
  27. assert:
  28. that: timezone_search is not changed
  29. success_msg: "{{ success_timezone_msg }}"
  30. fail_msg: "{{ fail_timezone_msg }}"
  31. register: timezone_check
  32. - name: Assert language for provisioning nodes
  33. fail:
  34. msg: "{{ fail_language }}"
  35. when: '"en-US" not in language'
  36. - name: Assert provisioning method
  37. assert:
  38. that:
  39. - provision_method == "PXE" or provision_method == "idrac"
  40. success_msg: "{{ success_provision_method }}"
  41. fail_msg: "{{ fail_provision_method }}"
  42. - name: Assert provision_state
  43. assert:
  44. that:
  45. - provision_state == "stateful"
  46. fail_msg: "{{ provision_state_fail_msg }}"
  47. success_msg: "{{ provision_state_success_msg }}"
  48. - name: Assert operating system
  49. assert:
  50. that:
  51. - provision_os == os_supported_centos or
  52. provision_os == os_supported_rocky or
  53. provision_os == os_supported_leap
  54. fail_msg: "{{ provision_os_fail_msg }}"
  55. success_msg: "{{ provision_os_success_msg }}"
  56. - name: Verify the iso_file_path
  57. stat:
  58. path: "{{ iso_file_path }}"
  59. register: result_path_iso_file
  60. - name : Assert iso_file_path location
  61. fail:
  62. msg: "{{ missing_iso_file_path }}"
  63. when: not result_path_iso_file.stat.exists
  64. - name: Validate iso_file_path name
  65. assert:
  66. that:
  67. - result_path_iso_file.stat.exists
  68. - '".iso" in iso_file_path'
  69. - provision_os in iso_file_path | lower
  70. fail_msg: "{{ invalid_iso_file_path }}"
  71. success_msg: "{{ valid_iso_file_path }}"