Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 1 | --- |
| 2 | # pxeboot tasks/main.yml |
| 3 | # |
| 4 | # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | - name: include OS-specific vars |
| 8 | include_vars: "{{ ansible_os_family }}.yml" |
| 9 | |
| 10 | - name: include OS-specific tasks |
| 11 | include_tasks: "{{ ansible_os_family }}.yml" |
| 12 | |
| 13 | - name: Create pxeboot dist dir |
| 14 | file: |
| 15 | state: directory |
| 16 | path: "{{ pxeboot_dist_dir }}" |
| 17 | owner: "{{ pxeboot_username }}" |
| 18 | group: "{{ pxeboot_groupname }}" |
| 19 | mode: "0755" |
| 20 | |
| 21 | - name: Create pxeboot webroot dir (may already exist from webserver role) |
| 22 | file: |
| 23 | state: directory |
| 24 | path: "{{ pxeboot_web_root }}" |
| 25 | owner: "{{ pxeboot_username }}" |
| 26 | group: "{{ pxeboot_groupname }}" |
| 27 | mode: "0755" |
| 28 | |
Zack Williams | 92f3c20 | 2021-08-24 23:04:47 -0700 | [diff] [blame] | 29 | # Download syslinux/memdisk, used by multiple images |
Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 30 | |
Zack Williams | 92f3c20 | 2021-08-24 23:04:47 -0700 | [diff] [blame] | 31 | - name: Create utils dir in webroot |
| 32 | file: |
| 33 | state: directory |
| 34 | path: "{{ pxeboot_web_root }}/utils" |
| 35 | owner: "{{ pxeboot_username }}" |
| 36 | group: "{{ pxeboot_groupname }}" |
| 37 | mode: "0755" |
| 38 | |
| 39 | - name: Download syslinux archive (contains memdisk) |
| 40 | get_url: |
| 41 | url: > |
| 42 | https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-{{ pxeboot_syslinux_version }}.zip |
| 43 | checksum: "{{ pxeboot_syslinux_checksum }}" |
| 44 | dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip" |
| 45 | owner: "root" |
| 46 | group: "root" |
| 47 | mode: "0644" |
| 48 | register: syslinux_dl |
| 49 | |
| 50 | - name: Create syslinux unarchive dir |
| 51 | file: |
| 52 | state: directory |
| 53 | path: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}" |
| 54 | owner: "root" |
| 55 | group: "{{ pxeboot_groupname }}" |
| 56 | mode: "0755" |
| 57 | |
| 58 | - name: Unarchive syslinux |
| 59 | unarchive: |
| 60 | remote_src: true |
| 61 | src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip" |
| 62 | dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}" |
| 63 | owner: "root" |
| 64 | group: "root" |
| 65 | mode: "0644" |
| 66 | |
| 67 | - name: Copy memdisk from syslinux |
| 68 | copy: |
| 69 | remote_src: true |
| 70 | src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}/memdisk/memdisk" |
| 71 | dest: "{{ pxeboot_web_root }}/utils/memdisk" |
| 72 | owner: "{{ pxeboot_username }}" |
| 73 | group: "{{ pxeboot_groupname }}" |
| 74 | mode: 0644 |
| 75 | |
| 76 | # create boot targets |
| 77 | - name: Include boot images |
| 78 | include_tasks: "{{ pxeboot_boot_image }}.yml" |
| 79 | loop: "{{ pxeboot_boot_images | flatten(levels=1) }}" |
| 80 | loop_control: |
| 81 | loop_var: pxeboot_boot_image |
| 82 | |
| 83 | # create menu |
Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 84 | - name: Create iPXE menu chainboot script from template |
| 85 | template: |
| 86 | src: "boot.ipxe.j2" |
| 87 | dest: "{{ pxeboot_web_root }}/boot.ipxe" |
| 88 | owner: "{{ pxeboot_username }}" |
| 89 | group: "{{ pxeboot_groupname }}" |
| 90 | mode: 0644 |