pv_validation.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. # Copyright 2021 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: Get auth string
  16. shell: echo -n {{ powervault_me4_username }}_{{ powervault_me4_password }} | sha256sum
  17. register: val_auth_string
  18. changed_when: false
  19. ignore_errors: yes
  20. tags: install
  21. - name: Get session key
  22. uri:
  23. url: https://{{ inventory_hostname }}/api/login/{{ val_auth_string.stdout | replace(" -", "") }}
  24. method: GET
  25. headers:
  26. {'datatype': 'json'}
  27. validate_certs: no
  28. register: val_session_key
  29. tags: install
  30. - name: Check if system name has space
  31. shell: echo {{ powervault_me4_system_name }} | grep '\s' -c
  32. register: space_count
  33. changed_when: false
  34. ignore_errors: true
  35. tags: install
  36. - name: Fail if system name has space
  37. assert:
  38. that:
  39. - space_count.stdout|int == 0
  40. - powervault_me4_system_name | length < 30
  41. msg: "{{ system_name_wrong }}"
  42. - name: Check if volume name has space
  43. shell: echo {{ powervault_me4_k8s_volume_name }} | grep '\s' -c
  44. register: vol_count1
  45. changed_when: false
  46. ignore_errors: true
  47. tags: install
  48. - name: Fail if volume name has space
  49. assert:
  50. that:
  51. - vol_count1.stdout == "0"
  52. - powervault_me4_k8s_volume_name | length < 30
  53. msg: "{{ system_name_wrong }}"
  54. - name: Check if volume name has space
  55. shell: echo {{ powervault_me4_slurm_volume_name }} | grep '\s' -c
  56. register: vol_count2
  57. changed_when: false
  58. ignore_errors: true
  59. tags: install
  60. - name: Assert if volume name has space
  61. assert:
  62. that:
  63. - vol_count2.stdout == "0"
  64. - powervault_me4_slurm_volume_name | length < 30
  65. msg: "{{ system_name_wrong }}"
  66. - name: Assert disk group name given if pool type is linear
  67. assert:
  68. that:
  69. - powervault_me4_disk_group_name| length > 1
  70. msg: "{{ system_name_wrong }}"
  71. when: powervault_me4_pool_type | lower == "linear"
  72. - name: Check if disk group name has space
  73. shell: echo {{ powervault_me4_disk_group_name }} | grep '\s' -c
  74. register: disk_count
  75. when: powervault_me4_disk_group_name | length > 1
  76. ignore_errors: true
  77. tags: install
  78. - name: Assert if disk group name has space
  79. assert:
  80. that:
  81. - disk_count.stdout == "0"
  82. - powervault_me4_disk_group_name | length < 30
  83. msg: "{{ system_name_wrong }}"
  84. when: powervault_me4_disk_group_name | length > 1
  85. - name: Assert snmp notification level
  86. assert:
  87. that:
  88. - powervault_me4_snmp_notify_level | length >1
  89. - powervault_me4_snmp_notify_level == "crit" or powervault_me4_snmp_notify_level == "error" or powervault_me4_snmp_notify_level == "warn" or powervault_me4_snmp_notify_level == "resolved" or powervault_me4_snmp_notify_level == "info" or powervault_me4_snmp_notify_level == "none"
  90. fail_msg: "{{ snmp_wrong_value }}"
  91. success_msg: "{{ snmp_success }}"
  92. - name: Assert RAID value
  93. assert:
  94. that: >
  95. powervault_me4_raid_levels| lower == "r1" or powervault_me4_raid_levels| lower == "raid1" or
  96. powervault_me4_raid_levels| lower == "r5" or powervault_me4_raid_levels| lower == "raid5" or
  97. powervault_me4_raid_levels| lower == "r6" or powervault_me4_raid_levels| lower == "raid6" or
  98. powervault_me4_raid_levels| lower == "r10" or powervault_me4_raid_levels| lower == "raid10" or
  99. powervault_me4_raid_levels| lower == "adapt"
  100. msg: "{{ raid_level_wrong }}"
  101. - name: Assert disk range
  102. assert:
  103. that:
  104. - powervault_me4_disk_range | length >1
  105. fail_msg: "{{ wrong_disk_range }}"
  106. success_msg: "{{ correct_disk_range }}"
  107. - name: Check pool value
  108. assert:
  109. that:
  110. - powervault_me4_pool == "a" or powervault_me4_pool == "A" or powervault_me4_pool == "b" or powervault_me4_pool == "B"
  111. msg: "{{ wrong_pool }}"
  112. when: powervault_me4_pool_type | lower == "virtual"
  113. - name: Check pool type
  114. assert:
  115. that:
  116. - powervault_me4_pool_type | length > 1
  117. - powervault_me4_pool_type | lower == "virtual" or powervault_me4_pool_type | lower == "linear"
  118. msg: "{{ wrong_pool_type }}"
  119. - name: Check parition percentage
  120. assert:
  121. that:
  122. - powervault_me4_disk_partition_size|int
  123. - powervault_me4_disk_partition_size|int < 90
  124. - powervault_me4_disk_partition_size|int > 5
  125. msg: "{{ wrong_partition }}"
  126. - name: Check the volume size
  127. assert:
  128. that: >
  129. 'GB' in powervault_me4_volume_size or 'TB' in powervault_me4_volume_size or
  130. 'MB' in powervault_me4_volume_size or
  131. 'B' in powervault_me4_volume_size
  132. msg: "{{ wrong_vol_size }}"
  133. - name: Assert the nic provided
  134. assert:
  135. that:
  136. - powervault_me4_server_nic | length > 2