create_vd.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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: Set RAID status
  16. set_fact:
  17. raid_type: true
  18. raid_controller_sensor: "{{ idrac_info.system_info.ControllerSensor[my_idx3].FQDD }}"
  19. raid_enclosure_name: "Enclosure.Internal.0-1:{{ idrac_info.system_info.ControllerSensor[my_idx3].FQDD }}"
  20. raid_vd_status: "{{ idrac_info.system_info.VirtualDisk is defined and idrac_info.system_info.VirtualDisk[0].Name == \"omnia_vd\" }}"
  21. with_items: "{{ idrac_info.system_info.Controller }}"
  22. loop_control:
  23. index_var: my_idx3
  24. when: '"RAID" in idrac_info.system_info.ControllerSensor[my_idx3].FQDD'
  25. - name: View existing storage details
  26. dellemc.openmanage.dellemc_idrac_storage_volume:
  27. idrac_ip: "{{ inventory_hostname }}"
  28. idrac_user: "{{ idrac_username }}"
  29. idrac_password: "{{ idrac_password }}"
  30. state: "view"
  31. register: idrac_volume_list
  32. when:
  33. - raid_type
  34. - not raid_vd_status
  35. - name: Set drives details
  36. set_fact:
  37. drives_id: "{{ idrac_volume_list.storage_status.Message.Controller[raid_controller_sensor].Enclosure[raid_enclosure_name].PhysicalDisk }}"
  38. drives_count: "{{ idrac_volume_list.storage_status.Message.Controller[raid_controller_sensor].Enclosure[raid_enclosure_name].PhysicalDisk | length }}"
  39. when:
  40. - raid_type
  41. - not raid_vd_status
  42. - idrac_volume_list.storage_status.Message.Controller[raid_controller_sensor].Enclosure[raid_enclosure_name].PhysicalDisk is defined
  43. - name: Create VD
  44. dellemc.openmanage.dellemc_idrac_storage_volume:
  45. idrac_ip: "{{ inventory_hostname }}"
  46. idrac_user: "{{ idrac_username }}"
  47. idrac_password: "{{ idrac_password }}"
  48. state: "create"
  49. controller_id: "{{ raid_controller_sensor }}"
  50. raid_reset_config: "True"
  51. volume_type: "{{ raid_level }}"
  52. raid_init_operation: "Fast"
  53. volumes:
  54. - name: "omnia_vd"
  55. span_length: "{{ drives_count }}"
  56. drives:
  57. id: "{{ drives_id }}"
  58. register: create_vd_status
  59. when:
  60. - raid_type
  61. - not raid_vd_status
  62. - idrac_volume_list.storage_status.Message.Controller[raid_controller_sensor].Enclosure[raid_enclosure_name].PhysicalDisk is defined