blob: f3a8f209b9fa5ee8e05ee4ba5c718eefcfca9ad7 [file] [log] [blame]
---
# pxeboot tasks/main.yml
#
# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
# SPDX-License-Identifier: Apache-2.0
- name: include OS-specific vars
include_vars: "{{ ansible_os_family }}.yml"
- name: include OS-specific tasks
include_tasks: "{{ ansible_os_family }}.yml"
- name: Create pxeboot dist dir
file:
state: directory
path: "{{ pxeboot_dist_dir }}"
owner: "{{ pxeboot_username }}"
group: "{{ pxeboot_groupname }}"
mode: "0755"
- name: Create pxeboot webroot dir (may already exist from webserver role)
file:
state: directory
path: "{{ pxeboot_web_root }}"
owner: "{{ pxeboot_username }}"
group: "{{ pxeboot_groupname }}"
mode: "0755"
# Download syslinux/memdisk, used by multiple images
- name: Create utils dir in webroot
file:
state: directory
path: "{{ pxeboot_web_root }}/utils"
owner: "{{ pxeboot_username }}"
group: "{{ pxeboot_groupname }}"
mode: "0755"
- name: Download syslinux archive (contains memdisk)
get_url:
url: >
https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-{{ pxeboot_syslinux_version }}.zip
checksum: "{{ pxeboot_syslinux_checksum }}"
dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip"
owner: "root"
group: "root"
mode: "0644"
register: syslinux_dl
- name: Create syslinux unarchive dir
file:
state: directory
path: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}"
owner: "root"
group: "{{ pxeboot_groupname }}"
mode: "0755"
- name: Unarchive syslinux
unarchive:
remote_src: true
src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip"
dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}"
owner: "root"
group: "root"
mode: "0644"
- name: Copy memdisk from syslinux
copy:
remote_src: true
src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}/memdisk/memdisk"
dest: "{{ pxeboot_web_root }}/utils/memdisk"
owner: "{{ pxeboot_username }}"
group: "{{ pxeboot_groupname }}"
mode: 0644
# create boot targets
- name: Include boot images
include_tasks: "{{ pxeboot_boot_image }}.yml"
loop: "{{ pxeboot_boot_images | flatten(levels=1) }}"
loop_control:
loop_var: pxeboot_boot_image
# create menu
- name: Create iPXE menu chainboot script from template
template:
src: "boot.ipxe.j2"
dest: "{{ pxeboot_web_root }}/boot.ipxe"
owner: "{{ pxeboot_username }}"
group: "{{ pxeboot_groupname }}"
mode: 0644