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

73 lines
1.8 KiB
YAML

---
- name: "Delete nfsroot '{{ fai_dir_nfsroot }}' to force rebuilt"
become: true
ansible.builtin.file:
path: "{{ fai_dir_nfsroot }}"
state: absent
when:
- fai_nfsroot_force_rebuild
- name: "Test if nfsroot dir '{{ fai_dir_nfsroot }}' already exists"
become: true
ansible.builtin.stat:
path: "{{ fai_dir_nfsroot }}"
register: nfsroot_res
- name: "fai-make-nfsroot - filesystem, kernel and initrd"
become: true
ansible.builtin.shell: fai-make-nfsroot
when:
- not nfsroot_res.stat.exists
- name: "fai-make-nfsroot - install packages from '{{ fai_etc_dir }}/NFSROOT'"
become: true
ansible.builtin.shell: fai-make-nfsroot -k
when:
- not nfsroot_res.stat.exists
- name: "Make basefiles"
become: true
ansible.builtin.shell:
cmd: "{{ fai_dir_config }}/basefiles/mk-basefile -J {{ item }}"
chdir: "{{ fai_dir_basefile }}"
creates: "{{ item }}.tar.xz"
loop:
- "FOCAL64"
- "JAMMY64"
tags:
- basefiles
- name: "Allow '{{ fai_loguser }}' to write to '{{ tftp_dir }}' to ship logs"
become: true
ansible.builtin.file:
path: "{{ tftp_dir }}"
state: directory
owner: "{{ fai_loguser }}"
group: "{{ fai_loguser }}"
mode: '0775'
when:
- fai_loguser is defined
- fai_loguser is not none
- false
- name: "Check for squashfs image of nfsroot in '{{ fai_squashfs_path }}'"
ansible.builtin.stat:
path: "{{ fai_squashfs_path }}"
register: squashfs
tags:
- ipxe
- fai_squashfs_stat
- name: "Generate a squashfs of nfsroot filesystem in '{{ fai_squashfs_path }}'"
become: true
ansible.builtin.shell:
cmd: >
fai-cd -f -M -S "{{ fai_squashfs_path }}"
-d "{{ http_mirror_fai_profiles_url }}"
when:
- not squashfs.stat.exists or
fai_nfsroot_force_rebuild
tags:
- ipxe
- fai_squashfs_generate