From 77590b067a6b10349103149ec2fea0817dbba1f1 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 18 Jun 2025 17:08:00 -0700 Subject: [PATCH] Create the static host volume for the new NFS --- ansible/nomad.yaml | 9 +++++++++ ansible/roles/nomad/files/nomad.hcl | 8 +++++++- ansible/roles/nomad/tasks/main.yaml | 28 ++++++++++++++++++---------- ansible/roles/nomad/vars/main.yaml | 1 + 4 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 ansible/nomad.yaml diff --git a/ansible/nomad.yaml b/ansible/nomad.yaml new file mode 100644 index 0000000..20459b9 --- /dev/null +++ b/ansible/nomad.yaml @@ -0,0 +1,9 @@ +--- +- name: Setup all the responsibilities of the nomad server + hosts: nigel.local + remote_user: nigel + tasks: + - name: Apply the nomad role + ansible.builtin.include_role: + name: nomad + diff --git a/ansible/roles/nomad/files/nomad.hcl b/ansible/roles/nomad/files/nomad.hcl index 0a93029..151484e 100644 --- a/ansible/roles/nomad/files/nomad.hcl +++ b/ansible/roles/nomad/files/nomad.hcl @@ -15,4 +15,10 @@ client { host_volume "registry" { path = "/opt/volumes/registry" read_only = false -} \ No newline at end of file +} + +host_volume "nfs" { + path = "/opt/volumes/nfs" + read_only = false +} + diff --git a/ansible/roles/nomad/tasks/main.yaml b/ansible/roles/nomad/tasks/main.yaml index aa8b1e8..227b9cc 100644 --- a/ansible/roles/nomad/tasks/main.yaml +++ b/ansible/roles/nomad/tasks/main.yaml @@ -1,10 +1,18 @@ -- name: Ensure the root data directory is present - ansible.builtin.file: - path: "{{ nomad.volumes.root }}" - state: directory - mode: "0755" -- name: Ensure registry volume is present - ansible.builtin.file: - path: "{{ nomad.volumes.registry }}" - state: directory - mode: "0755" +- name: Nomad server configuration + become: true + block: + - name: Ensure the root data directory is present + ansible.builtin.file: + path: "{{ nomad.volumes.root }}" + state: directory + mode: "0755" + - name: Ensure registry volume is present + ansible.builtin.file: + path: "{{ nomad.volumes.registry }}" + state: directory + mode: "0755" + - name: Ensure the MinIO diretory is present + ansible.builtin.file: + path: "{{ nomad.volumes.nfs }}" + state: directory + mode: "0755" diff --git a/ansible/roles/nomad/vars/main.yaml b/ansible/roles/nomad/vars/main.yaml index af2b1d2..4492a9e 100644 --- a/ansible/roles/nomad/vars/main.yaml +++ b/ansible/roles/nomad/vars/main.yaml @@ -2,3 +2,4 @@ nomad: volumes: root: /opt/volumes registry: /opt/volumes/ncr + nfs: /opt/volumes/nfs