generate_disks_base.yml 2.3 KB

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