From d442ac232e086c2d5aff8be57c1b337b3aa3ff83 Mon Sep 17 00:00:00 2001 From: Donavan Fritz Date: Wed, 1 Jan 2025 20:29:15 -0600 Subject: [PATCH] NFS mount for container templates --- compute/playbook-host-proxmox.yaml | 11 +++++++++-- lxc/playbook-base-lxc.yaml | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compute/playbook-host-proxmox.yaml b/compute/playbook-host-proxmox.yaml index 357486d..0847162 100644 --- a/compute/playbook-host-proxmox.yaml +++ b/compute/playbook-host-proxmox.yaml @@ -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/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 diff --git a/lxc/playbook-base-lxc.yaml b/lxc/playbook-base-lxc.yaml index 91470c5..68e5d99 100644 --- a/lxc/playbook-base-lxc.yaml +++ b/lxc/playbook-base-lxc.yaml @@ -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 }}"