--- - name: Configure Nomad client for NFS volumes hosts: nomad_clients become: yes vars: nfs_mount_path: /mnt/fnsync tasks: - name: Create Nomad plugin directory for NFS file: path: /opt/nomad/plugins state: directory owner: nomad group: nomad mode: '0755' - name: Configure Nomad client to use NFS volumes blockinfile: path: /etc/nomad.d/nomad.hcl marker: "# {mark} NFS VOLUME CONFIGURATION" block: | plugin "nomad-driver-podman" { config { volumes { enabled = true } } } client { host_volume "nfs-shared" { path = "{{ nfs_mount_path }}/nomad/volumes" read_only = false } } insertafter: 'data_dir = "/opt/nomad/data"' - name: Restart Nomad service to apply changes systemd: name: nomad state: restarted - name: Verify Nomad client configuration command: nomad node status -self register: nomad_status ignore_errors: yes - name: Display Nomad status debug: msg: "{{ inventory_hostname }} - Nomad status: {{ '运行中' if nomad_status.rc == 0 else '异常' }}"