deploy_os.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: Configure boot order for PXE booting
  16. dellemc.openmanage.idrac_bios:
  17. idrac_ip: "{{ inventory_hostname }}"
  18. idrac_user: "{{ idrac_username }}"
  19. idrac_password: "{{ idrac_password }}"
  20. attributes:
  21. SetBootOrderEn: NIC.PxeDevice.1-1,NIC.PxeDevice.2-1,NIC.PxeDevice.3-1,NIC.PxeDevice.4-1
  22. UefiBootSeq: NIC.PxeDevice.1-1,NIC.PxeDevice.2-1,NIC.PxeDevice.3-1,NIC.PxeDevice.4-1
  23. register: deploy_os_pxe
  24. when: provision_method == "pxe"
  25. - name: Set deploy_os_status when provision_method == pxe
  26. set_fact:
  27. deploy_os_status: "{{ not deploy_os_pxe.failed }}"
  28. when: provision_method == "pxe"
  29. - name: Install OS using iDRAC
  30. dellemc.openmanage.idrac_os_deployment:
  31. idrac_ip: "{{ inventory_hostname }}"
  32. idrac_user: "{{ idrac_username }}"
  33. idrac_password: "{{ idrac_password }}"
  34. share_name: "{{ management_station_ip }}:{{ nfs_share_offline_repo }}"
  35. iso_image: "{{ unattended_iso_filename }}"
  36. expose_duration: "{{ expose_duration }}"
  37. register: deploy_os_idrac
  38. when: provision_method == "idrac"
  39. - name: Set deploy_os_status when provision_method == idrac
  40. set_fact:
  41. deploy_os_status: "{{ not deploy_os_idrac.failed }}"
  42. when: provision_method == "idrac"
  43. - name: Add to provisioned_hosts to inventory
  44. command: >-
  45. awx --conf.host {{ awx_host }} --conf.username {{ awx_username }} --conf.password {{ awx_password }}
  46. hosts create --name {{ inventory_hostname }} --inventory "{{ provisioned_idrac_inventory_name }}"
  47. register: update_inventory
  48. changed_when: true
  49. no_log: true
  50. when:
  51. - awx_search_key in hostname.stdout
  52. - inventory_hostname not in fetch_inventory.stdout
  53. - deploy_os_status
  54. - name: Provision OS status
  55. debug:
  56. msg: "{{ provision_os_msg }}"
  57. when: deploy_os_status