create_unattended_iso.yml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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: ISO creation - centos
  16. block:
  17. - name: Create custom ISO
  18. command: >-
  19. mkisofs -o /tmp/{{ centos_iso_filename }} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4
  20. -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -J -R -V "CentOS 7 x86_64" {{ tmp_iso_dir }}
  21. changed_when: true
  22. register: centos_iso_status
  23. tags: install
  24. args:
  25. chdir: "{{ tmp_iso_dir }}"
  26. - name: Custom ISO creation status check
  27. assert:
  28. that:
  29. - "'Total directory bytes:' in centos_iso_status.stderr"
  30. - "'Path table size(bytes):' in centos_iso_status.stderr"
  31. - "'Max brk space used' in centos_iso_status.stderr"
  32. - "'extents written' in centos_iso_status.stderr"
  33. success_msg: "{{ custom_iso_success_msg }}"
  34. fail_msg: "{{ custom_iso_fail_msg }}"
  35. - name: Copy ISO file to nfs share
  36. copy:
  37. src: "/tmp/{{ centos_iso_filename }}"
  38. dest: "{{ nfs_share_offline_repo }}/{{ centos_iso_filename }}"
  39. mode: preserve
  40. tags: install
  41. when: provision_os == os_supported_centos
  42. - name: ISO creation - rocky
  43. block:
  44. - name: Create custom ISO
  45. command: >-
  46. mkisofs -o /tmp/{{ rocky_iso_filename }} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4
  47. -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -J -R -V "Rocky-8-4-x86_64-dvd" {{ tmp_iso_dir }}
  48. changed_when: true
  49. register: rocky_iso_status
  50. tags: install
  51. args:
  52. chdir: "{{ tmp_iso_dir }}"
  53. - name: Custom ISO creation status check
  54. assert:
  55. that:
  56. - "'Total directory bytes:' in rocky_iso_status.stderr"
  57. - "'Path table size(bytes):' in rocky_iso_status.stderr"
  58. - "'Max brk space used' in rocky_iso_status.stderr"
  59. - "'extents written' in rocky_iso_status.stderr"
  60. success_msg: "{{ custom_iso_success_msg }}"
  61. fail_msg: "{{ custom_iso_fail_msg }}"
  62. - name: Copy ISO file to nfs share
  63. copy:
  64. src: "/tmp/{{ rocky_iso_filename }}"
  65. dest: "{{ nfs_share_offline_repo }}/{{ rocky_iso_filename }}"
  66. mode: preserve
  67. tags: install
  68. when: provision_os == os_supported_rocky
  69. - name: Remove the kickstart file
  70. file:
  71. path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
  72. state: absent
  73. tags: install