volume.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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: vol_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/{{ vol_auth_string.stdout | replace(" -", "") }}
  24. method: GET
  25. headers:
  26. {'datatype': 'json'}
  27. validate_certs: no
  28. register: vol_session_key
  29. tags: install
  30. - name: Add disk group
  31. uri:
  32. url: https://{{ inventory_hostname }}/api/add/disk-group/type/{{ type }}/disks/{{ powervault_me4_disk_range }}/level/{{ powervault_me4_raid_levels }}/pool/{{ powervault_me4_pool }}/{{ powervault_me4_disk_group_name }}
  33. method: GET
  34. body_format: json
  35. validate_certs: no
  36. use_proxy: no
  37. headers:
  38. {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
  39. register: pv_disk
  40. tags: install
  41. - name: Assert if disk group created or not
  42. fail:
  43. msg: "{{ pv_disk.json.status[0].response }}"
  44. when: pv_disk.json.status[0] ['response-type'] == "Error"
  45. - name: Create volume1
  46. uri:
  47. url: https://{{ inventory_hostname }}/api/create/volume/size/{{ powervault_me4_volume_size }}/pool/{{ powervault_me4_pool }}/{{ powervault_me4_k8s_volume_name }}
  48. method: GET
  49. body_format: json
  50. validate_certs: no
  51. use_proxy: no
  52. headers:
  53. {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
  54. register: pv_vol1
  55. tags: install
  56. - name: Create volume2
  57. uri:
  58. url: https://{{ inventory_hostname }}/api/create/volume/size/{{ powervault_me4_volume_size }}/pool/{{ powervault_me4_pool }}/{{ powervault_me4_slurm_volume_name }}
  59. method: GET
  60. body_format: json
  61. validate_certs: no
  62. use_proxy: no
  63. headers:
  64. {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
  65. register: pv_vol2
  66. tags: install
  67. - name: Assert if k8s_volume created correctly
  68. fail:
  69. msg: "{{ pv_vol1.json.status[0].response }}"
  70. when: pv_vol1.json.status[0]['response-type'] == "Error"
  71. - name: Assert if slurm_volume created correctly
  72. fail:
  73. msg: "{{ pv_vol2.json.status[0].response }}"
  74. when: pv_vol2.json.status[0]['response-type'] == "Error"