generate_disks_base.yml 2.3 KB

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