ansible-install-server/roles/fai/tasks/fai-pxe.yml

51 lines
1.2 KiB
YAML

- find:
paths: /srv/fai/nfsroot/boot
patterns: "vmlinuz-*"
register: fai_live_vmlinuz
- find:
paths: /srv/fai/nfsroot/boot
patterns: "initrd.img-*"
register: fai_live_initrd
- set_fact:
fai_live_vmlinuz: "{{ fai_live_vmlinuz.files[0].path |regex_replace('.*/', '') }}"
fai_live_initrd: "{{ fai_live_initrd.files[0].path |regex_replace('.*/', '') }}"
- name: copy linux kernel and initrd to tftp root
copy:
src: "/srv/fai/nfsroot/boot/{{ item }}"
dest: "/srv/tftp/fai/{{ item }}"
owner: root
group: root
mode: u=rw,g=r,o=r
remote_src: true
with_items:
- "{{ fai_live_vmlinuz }}"
- "{{ fai_live_initrd }}"
- name: generate squashfs image of root files
stat:
path: /srv/tftp/fai/squash.img
register: squash_img
- name: generate a downloadable squashfs of root filesystem
shell: fai-cd -f -M -S /srv/tftp/fai/squash.img
when: "not squash_img.stat.exists or fai_profiles.changed or fai_profiles_apt_proxy.changed"
- name: copy dban image
copy:
src: files/dban/dban.bzi
dest: /srv/tftp/fai/dban.bzi
owner: root
group: root
mode: u=rw,g=r,o=r
- name: setup iPXE
include: fai-pxe-ipxe.yml
- name: force restart tftp server
service:
name: tftpd-hpa
state: restarted