summaryrefslogtreecommitdiff
path: root/roles/create-pxe-archive/tasks/main.yml
blob: 1fe6e93fd8739a064c23007d6ebc2a3fb82c4c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Create an archive with files, required for PXE
- name: Create directory for PXE files
  become: true
  file:
    path: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag  | default() }}"
    state: directory
  when:
    - pxe is defined
    - pxe == "true"

- name: Save files required for PXE boot
  become: true
  copy:
    src: "{{ vyos_write_root }}/boot/{{ vyos_version }}/{{ item }}"
    dest: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag  | default() }}/{{ item }}"
  with_items:
    - initrd.img
    - vmlinuz
  when:
    - pxe is defined
    - pxe == "true"

# We need to skip boot directory (it contain too much unneeded items) and cc_vyos.py (optionally - may conflict with User-Data handler)
- name: Create new squashfs image
  become: true
  command: "mksquashfs {{ vyos_install_root }} /tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag  | default() }}/filesystem.squashfs -comp gzip -no-progress -Xcompression-level 9 -e {{ vyos_install_root }}/boot -e {{ vyos_install_root }}/usr/lib/python3/dist-packages/cloudinit/config/cc_vyos.py"
  when:
    - pxe is defined
    - pxe == "true"

- name: Add the /boot directory
  become: true
  command: "mksquashfs {{ vyos_read_root }}/boot /tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag  | default() }}/filesystem.squashfs -keep-as-directory -comp gzip -no-progress -Xcompression-level 9"
  when:
    - pxe is defined
    - pxe == "true"

- name: Create an archive with files for PXE
  become: true
  archive:
    path: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag  | default() }}"
    format: gz
    dest: "/tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag  | default() }}.tgz"
  when:
    - pxe is defined
    - pxe == "true"