create_unattended_iso.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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: Fetch rocky profile name
  45. shell: set -o pipefail && grep 'Rocky-8' {{ tmp_iso_dir }}{{ grub_cfg_path }} | head -1
  46. register: rocky_profile_name
  47. changed_when: false
  48. - name: Create custom ISO
  49. command: >-
  50. mkisofs -o /tmp/{{ rocky_iso_filename }} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4
  51. -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -J -R -V {{ rocky_profile_name.stdout.split(' ')[4] | replace("'","") }} {{ tmp_iso_dir }}
  52. changed_when: true
  53. register: rocky_iso_status
  54. tags: install
  55. args:
  56. chdir: "{{ tmp_iso_dir }}"
  57. - name: Custom ISO creation status check
  58. assert:
  59. that:
  60. - "'Total directory bytes:' in rocky_iso_status.stderr"
  61. - "'Path table size(bytes):' in rocky_iso_status.stderr"
  62. - "'Max brk space used' in rocky_iso_status.stderr"
  63. - "'extents written' in rocky_iso_status.stderr"
  64. success_msg: "{{ custom_iso_success_msg }}"
  65. fail_msg: "{{ custom_iso_fail_msg }}"
  66. - name: Copy ISO file to nfs share
  67. copy:
  68. src: "/tmp/{{ rocky_iso_filename }}"
  69. dest: "{{ nfs_share_offline_repo }}/{{ rocky_iso_filename }}"
  70. mode: preserve
  71. tags: install
  72. when: provision_os == os_supported_rocky
  73. - name: Remove the kickstart file
  74. file:
  75. path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
  76. state: absent
  77. tags: install