pv_validation.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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: Check if disk name has space
  67. shell: echo {{ powervault_me4_disk_group_name }} | grep '\s' -c
  68. register: disk_count
  69. when: powervault_me4_disk_group_name | length > 1
  70. ignore_errors: true
  71. tags: install
  72. - name: Assert if disk name has space
  73. assert:
  74. that:
  75. - disk_count.stdout == "0"
  76. - powervault_me4_disk_group_name | length > 1
  77. - powervault_me4_disk_group_name | length < 30
  78. msg: "{{ system_name_wrong }}"
  79. - name: Assert snmp notification level
  80. assert:
  81. that:
  82. - powervault_me4_snmp_notify_level | length >1
  83. - 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"
  84. fail_msg: "{{ snmp_wrong_value }}"
  85. success_msg: "{{ snmp_success }}"
  86. - name: Assert RAID value
  87. assert:
  88. that: >
  89. powervault_me4_raid_levels| lower == "r1" or powervault_me4_raid_levels| lower == "raid1" or
  90. powervault_me4_raid_levels| lower == "r5" or powervault_me4_raid_levels| lower == "raid5" or
  91. powervault_me4_raid_levels| lower == "r6" or powervault_me4_raid_levels| lower == "raid6" or
  92. powervault_me4_raid_levels| lower == "r10" or powervault_me4_raid_levels| lower == "raid10" or
  93. powervault_me4_raid_levels| lower == "adapt"
  94. msg: "{{ raid_level_wrong }}"
  95. - name: Assert disk range
  96. assert:
  97. that:
  98. - powervault_me4_disk_range | length >1
  99. fail_msg: "{{ wrong_disk_range }}"
  100. success_msg: "{{ correct_disk_range }}"
  101. - name: Check pool value
  102. assert:
  103. that:
  104. - powervault_me4_pool == "a" or powervault_me4_pool == "A" or powervault_me4_pool == "b" or powervault_me4_pool == "B"
  105. msg: "{{ wrong_pool }}"
  106. when: powervault_me4_pool_type == "virtual"
  107. - name: Check pool type
  108. assert:
  109. that:
  110. - powervault_me4_pool_type | length > 1
  111. - powervault_me4_pool_type | lower == "virtual" or powervault_me4_pool_type | lower == "linear"
  112. msg: "{{ wrong_pool_type }}"
  113. - name: Check parition percentage
  114. assert:
  115. that:
  116. - powervault_me4_disk_partition_size|int
  117. - powervault_me4_disk_partition_size|int < 90
  118. - powervault_me4_disk_partition_size|int > 5
  119. msg: "{{ wrong_partition }}"
  120. - name: Check the volume size
  121. assert:
  122. that: >
  123. 'GB' in powervault_me4_volume_size or 'TB' in powervault_me4_volume_size or
  124. 'MB' in powervault_me4_volume_size or
  125. 'B' in powervault_me4_volume_size
  126. msg: "{{ wrong_vol_size }}"
  127. - name: Assert the nic provided
  128. assert:
  129. that:
  130. - powervault_me4_server_nic | length > 2