NFS mount for container templates

This commit is contained in:
Donavan Fritz 2025-01-01 20:29:15 -06:00
parent 49a1dc59c2
commit d442ac232e
2 changed files with 13 additions and 6 deletions

View File

@ -124,13 +124,20 @@
path: /mnt/iso-images/template/iso
state: directory
- name: Ensure Container Templates mount point directory exists in sjc001
when: "'sjc001' in ansible_host"
ansible.builtin.file:
path: /mnt/container-templates/cache
state: directory
- name: Insert/update NFS mount block in /etc/fstab in sjc001
when: "'sjc001' in inventory_hostname"
when: "'sjc001' in ansible_host"
notify: reload fstab
ansible.builtin.blockinfile:
path: /etc/fstab
block: |
nas001.sjc001.fritzlab.net:/mnt/main/iso /mnt/iso-images/template/iso nfs4 rw 0 0
nas001.sjc001.fritzlab.net:/mnt/main/container-templates /mnt/container-templates/cache nfs4 rw 0 0
marker: "# {mark} ANSIBLE MANAGED BLOCK for NFS mounts"
backup: yes

View File

@ -8,9 +8,9 @@
debian_version: "bookworm"
lxc_name: "fritzlab-base"
lxc_image_artifact_name: "{{ lxc_name }}-{{ timestamp }}.tar.gz"
lxc_base_dir: "/var/lib/lxc"
lxc_template_dir: "/var/lib/vz/template/cache"
working_lxc_dir: "{{ lxc_base_dir }}/{{ lxc_name }}"
lxc_build_dir: "/tmp/build_{{ lxc_name }}_{{ timestamp }}"
lxc_template_dir: "/mnt/container-templates/cache"
working_lxc_dir: "{{ lxc_build_dir }}/{{ lxc_name }}"
working_rootfs_dir: "{{ working_lxc_dir }}/rootfs"
working_chroot: "chroot {{ working_rootfs_dir }}"
lxc_unnecessary_units:
@ -156,7 +156,7 @@
args:
creates: /tmp/{{ lxc_image_artifact_name }}
- name: Move artifact to destination on host
- name: Move artifact to NFS Share
command:
cmd: "mv /tmp/{{ lxc_image_artifact_name }} {{ lxc_template_dir }}"