deploy_os.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 one-time boot device to PXE
  16. community.general.redfish_command:
  17. category: Systems
  18. command: SetOneTimeBoot
  19. bootdevice: "Pxe"
  20. baseuri: "{{ inventory_hostname }}"
  21. username: "{{ idrac_username }}"
  22. password: "{{ idrac_password }}"
  23. when: not (enterprise_license or datacenter_license)
  24. - name: Reboot server
  25. dellemc.openmanage.redfish_powerstate:
  26. baseuri: "{{ inventory_hostname }}"
  27. username: "{{ idrac_username }}"
  28. password: "{{ idrac_password }}"
  29. reset_type: ForceRestart
  30. when: not (enterprise_license or datacenter_license)
  31. register: deploy_os
  32. - name: Install OS using iDRAC
  33. dellemc.openmanage.idrac_os_deployment:
  34. idrac_ip: "{{ inventory_hostname }}"
  35. idrac_user: "{{ idrac_username }}"
  36. idrac_password: "{{ idrac_password }}"
  37. share_name: "{{ public_ip }}:{{ nfs_share_offline_repo }}"
  38. iso_image: "{{ unattended_iso_filename }}"
  39. expose_duration: "{{ expose_duration }}"
  40. register: deploy_os
  41. when: enterprise_license or datacenter_license
  42. - name: Add idrac ip to provisioned_idrac_ip.yml
  43. lineinfile:
  44. path: "{{ role_path }}/files/provisioned_idrac_ip.yml"
  45. create: yes
  46. mode: "{{ file_permission }}"
  47. line: "{{ inventory_hostname }}"
  48. when: not deploy_os.failed