123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- # Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- ---
- - name: Get auth string
- shell: echo -n {{ powervault_me4_username }}_{{ powervault_me4_password }} | sha256sum
- register: vol_auth_string
- changed_when: false
- ignore_errors: yes
- tags: install
- - name: Get session key
- uri:
- url: https://{{ inventory_hostname }}/api/login/{{ vol_auth_string.stdout | replace(" -", "") }}
- method: GET
- headers:
- {'datatype': 'json'}
- validate_certs: no
- register: vol_session_key
- tags: install
- - name: Add disk group in virtual pool
- uri:
- url: https://{{ inventory_hostname }}/api/add/disk-group/type/{{ powervault_me4_pool_type }}/disks/{{ powervault_me4_disk_range }}/level/{{ powervault_me4_raid_levels }}/pool/{{ powervault_me4_pool }}/{{ powervault_me4_disk_group_name }}
- method: GET
- body_format: json
- validate_certs: no
- use_proxy: no
- headers:
- {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
- register: pv_disk1
- when: powervault_me4_pool_type|lower == "virtual"
- tags: install
- - name: Add disk group in linear pool
- uri:
- url: https://{{ inventory_hostname }}/api/add/disk-group/type/{{ powervault_me4_pool_type }}/disks/{{ powervault_me4_disk_range }}/level/{{ powervault_me4_raid_levels }}/{{ powervault_me4_disk_group_name }}
- method: GET
- body_format: json
- validate_certs: no
- use_proxy: no
- headers:
- {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
- register: pv_disk2
- when: powervault_me4_pool_type|lower == "linear"
- tags: install
- - name: Assert if disk group created or not
- fail:
- msg: "{{ pv_disk1.json.status[0].response }}"
- when:
- - powervault_me4_pool_type|lower == "virtual"
- - pv_disk1.json.status[0] ['response-type'] == "Error"
- - name: Assert if disk group created or not
- fail:
- msg: "{{ pv_disk2.json.status[0].response }}"
- when:
- - powervault_me4_pool_type|lower == "linear"
- - pv_disk2.json.status[0] ['response-type'] == "Error"
- - name: Create volume1
- uri:
- url: https://{{ inventory_hostname }}/api/create/volume/size/{{ powervault_me4_volume_size }}/pool/{{ powervault_me4_pool }}/{{ powervault_me4_k8s_volume_name }}
- method: GET
- body_format: json
- validate_certs: no
- use_proxy: no
- headers:
- {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
- register: pv_vol1
- when: powervault_me4_pool_type|lower == "virtual"
- tags: install
- - name: Create volume2
- uri:
- url: https://{{ inventory_hostname }}/api/create/volume/size/{{ powervault_me4_volume_size }}/pool/{{ powervault_me4_pool }}/{{ powervault_me4_slurm_volume_name }}
- method: GET
- body_format: json
- validate_certs: no
- use_proxy: no
- headers:
- {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
- register: pv_vol2
- when: powervault_me4_pool_type|lower == "virtual"
- tags: install
- - name: Create volume1
- uri:
- url: https://{{ inventory_hostname }}/api/create/volume/size/{{ powervault_me4_volume_size }}/pool/{{ powervault_me4_disk_group_name }}/{{ powervault_me4_k8s_volume_name }}
- method: GET
- body_format: json
- validate_certs: no
- use_proxy: no
- headers:
- {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
- register: pv_vol3
- when: powervault_me4_pool_type|lower == "linear"
- tags: install
- - name: Create volume2
- uri:
- url: https://{{ inventory_hostname }}/api/create/volume/size/{{ powervault_me4_volume_size }}/pool/{{ powervault_me4_disk_group_name }}/{{ powervault_me4_slurm_volume_name }}
- method: GET
- body_format: json
- validate_certs: no
- use_proxy: no
- headers:
- {'sessionKey': "{{ vol_session_key.json.status[0].response }}", 'datatype':'json'}
- register: pv_vol4
- when: powervault_me4_pool_type|lower == "linear"
- tags: install
- - name: Assert if k8s_volume created correctly
- fail:
- msg: "{{ pv_vol1.json.status[0].response }}"
- when:
- - powervault_me4_pool_type| lower == "virtual"
- - pv_vol1.json.status[0]['response-type'] == "Error"
- - name: Assert if slurm_volume created correctly
- fail:
- msg: "{{ pv_vol2.json.status[0].response }}"
- when:
- - powervault_me4_pool_type| lower == "virtual"
- - pv_vol2.json.status[0]['response-type'] == "Error"
- - name: Assert if k8s_volume created correctly
- fail:
- msg: "{{ pv_vol3.json.status[0].response }}"
- when:
- - powervault_me4_pool_type| lower == "linear"
- - pv_vol3.json.status[0]['response-type'] == "Error"
- - name: Assert if slurm_volume created correctly
- fail:
- msg: "{{ pv_vol4.json.status[0].response }}"
- when:
- - powervault_me4_pool_type|lower == "linear"
- - pv_vol4.json.status[0]['response-type'] == "Error"
|