Files
netboot.xyz/roles/netbootxyz/tasks/generate_disks_base.yml
Antony Messerli 8ab45836fc Fix Ansible INJECT_FACTS_AS_VARS deprecation warnings
Replace deprecated top-level ansible_* fact variables with the
ansible_facts[] dictionary syntax to silence deprecation warnings
from ansible-core and prepare for removal in ansible-core 2.24.

- generate_disks_base.yml: ansible_distribution, ansible_os_family,
  ansible_distribution_version, ansible_distribution_major_version
- generate_checksums.yml: ansible_os_family

Ref #1745
2026-03-14 00:24:01 -05:00

90 lines
2.6 KiB
YAML

---
- name: Gathering facts
ansible.builtin.setup:
- name: Gather variables for each operating system
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
- name: Ensure EPEL is enabled
ansible.builtin.dnf:
name: epel-release
state: present
when:
- ansible_facts['distribution'] == "CentOS"
- name: Set var to bootloader of loop
ansible.builtin.set_fact:
bootloader_filename: "{{ bootloader_file }}"
- name: Create iPXE file directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ netbootxyz_root }}/ipxe"
- "{{ cert_dir }}"
- name: Retrieve latest wimboot
ansible.builtin.get_url:
url: "{{ wimboot_upstream_url }}"
dest: "{{ netbootxyz_root }}/wimboot"
- name: Copy helper apps
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ netbootxyz_root }}"
with_items:
- memdisk
- name: Install required packages
ansible.builtin.package:
name: "{{ item }}"
state: present
with_items: "{{ netbootxyz_packages }}"
- name: Check out latest iPXE sources
ansible.builtin.git:
repo: "{{ ipxe_repo }}"
dest: "{{ ipxe_source_dir }}"
version: "{{ ipxe_branch }}"
force: true
register: ipxe_git_checkout
- name: Copy iPXE Bootloader template to iPXE source directory
ansible.builtin.template:
src: "disks/{{ bootloader_filename }}.j2"
dest: "{{ ipxe_source_dir }}/src/{{ bootloader_filename }}"
- name: Touch iPXE config local files
ansible.builtin.file:
path: "{{ ipxe_source_dir }}/{{ item }}"
state: touch
with_items:
- src/config/local/umalloc.h
- src/config/local/nap.h
- src/config/local/timer.h
- src/config/local/branding.h
- src/config/local/serial.h
- src/config/local/reboot.h
- src/config/local/sanboot.h
- src/config/local/fault.h
- src/config/local/dhcp.h
- src/config/local/sideband.h
- src/config/local/entropy.h
- src/config/local/crypto.h
- src/config/local/usb.h
- src/config/local/settings.h
- src/config/local/isa.h
- name: Retrieve iPXE CA
ansible.builtin.get_url:
url: "{{ ipxe_ca_url }}"
dest: "{{ cert_dir }}/{{ ipxe_ca_filename }}"