summaryrefslogtreecommitdiff
path: root/roles/create-pxe-archive/tasks/main.yml
blob: 4471f27967197f6d94a8162f0048f2b02dfea119 (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
47
48
49
50
51
52
53
54
55
# 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"
    - pxe_excl_module is defined
    - pxe_excl_module == "true"

- 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"
  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"