generate_disks_base.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ---
  2. - name: Gathering facts
  3. ansible.builtin.setup:
  4. - name: Gather variables for each operating system
  5. ansible.builtin.include_vars: "{{ item }}"
  6. with_first_found:
  7. - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
  8. - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
  9. - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
  10. - "{{ ansible_distribution | lower }}.yml"
  11. - "{{ ansible_os_family | lower }}.yml"
  12. - name: Ensure EPEL is enabled
  13. ansible.builtin.dnf:
  14. name: epel-release
  15. state: present
  16. when:
  17. - ansible_distribution == "CentOS"
  18. - name: Set var to bootloader of loop
  19. ansible.builtin.set_fact:
  20. bootloader_filename: "{{ bootloader_file }}"
  21. - name: Create iPXE file directories
  22. ansible.builtin.file:
  23. path: "{{ item }}"
  24. state: directory
  25. with_items:
  26. - "{{ netbootxyz_root }}/ipxe"
  27. - "{{ cert_dir }}"
  28. - name: Retrieve latest wimboot
  29. ansible.builtin.get_url:
  30. url: "{{ wimboot_upstream_url }}"
  31. dest: "{{ netbootxyz_root }}/wimboot"
  32. - name: Copy helper apps
  33. ansible.builtin.copy:
  34. src: "{{ item }}"
  35. dest: "{{ netbootxyz_root }}"
  36. with_items:
  37. - memdisk
  38. - name: Install required packages
  39. ansible.builtin.package:
  40. name: "{{ item }}"
  41. state: present
  42. with_items: "{{ netbootxyz_packages }}"
  43. - name: Check out latest iPXE sources
  44. ansible.builtin.git:
  45. repo: "{{ ipxe_repo }}"
  46. dest: "{{ ipxe_source_dir }}"
  47. version: "{{ ipxe_branch }}"
  48. force: true
  49. register: ipxe_git_checkout
  50. - name: Copy iPXE Bootloader template to iPXE source directory
  51. ansible.builtin.template:
  52. src: "disks/{{ bootloader_filename }}.j2"
  53. dest: "{{ ipxe_source_dir }}/src/{{ bootloader_filename }}"
  54. - name: Touch iPXE config local files
  55. ansible.builtin.file:
  56. path: "{{ ipxe_source_dir }}/{{ item }}"
  57. state: touch
  58. with_items:
  59. - src/config/local/umalloc.h
  60. - src/config/local/nap.h
  61. - src/config/local/timer.h
  62. - src/config/local/branding.h
  63. - src/config/local/serial.h
  64. - src/config/local/reboot.h
  65. - src/config/local/sanboot.h
  66. - src/config/local/fault.h
  67. - src/config/local/dhcp.h
  68. - src/config/local/sideband.h
  69. - src/config/local/entropy.h
  70. - src/config/local/crypto.h
  71. - src/config/local/usb.h
  72. - src/config/local/settings.h
  73. - src/config/local/isa.h
  74. - name: Retrieve iPXE CA
  75. ansible.builtin.get_url:
  76. url: "{{ ipxe_ca_url }}"
  77. dest: "{{ cert_dir }}/{{ ipxe_ca_filename }}"