commit 40f7fe75da402336db6b774c8a32314455224489
parent d23e779d871acd60844a195f847612272888d668
Author: Andreas Gruhler <agruhl@gmx.ch>
Date: Mon, 7 Feb 2022 21:33:37 +0100
feat(nomad): add nfs
Diffstat:
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/bootstrap.sh b/bootstrap.sh
@@ -22,7 +22,7 @@ echo "nameserver 8.8.8.8" > /etc/resolv.conf
# Sync packages
pacman -Syy --noconfirm
-pacman -S parted man sudo unzip inetutils jq docker --noconfirm
+pacman -S parted man sudo unzip inetutils jq docker nfs-utils --noconfirm
# Disable software rng and enable docker
systemctl disable haveged
diff --git a/hashi-pi.json b/hashi-pi.json
@@ -16,6 +16,9 @@
"nomad_version": "1.2.3",
"nomad_binary_path": "./bin",
"nomad_arch": "arm",
+ "nomad_nfs_server": "",
+ "nomad_nfs_mount": "",
+ "nomad_nfs_target": "",
"vault_version": "1.9.2",
"vault_arch": "arm",
"vault_tls_ca_cert": "./tls/vault/ca/vault_ca.pem",
@@ -124,7 +127,10 @@
"USERNAME={{ user `username` }}",
"NOMAD_VERSION={{ user `nomad_version` }}",
"NOMAD_BINARY_PATH={{ user `nomad_binary_path` }}",
- "NOMAD_ARCH={{ user `nomad_arch` }}"
+ "NOMAD_ARCH={{ user `nomad_arch` }}",
+ "NFS_SERVER={{ user `nomad_nfs_server` }}",
+ "NFS_MOUNT={{ user `nomad_nfs_mount` }}",
+ "NFS_MOUNT_TARGET={{ user `nomad_nfs_target` }}"
]
},
{
diff --git a/nomad.sh b/nomad.sh
@@ -107,4 +107,13 @@ systemctl enable nomad
cat << EOF >> .bashrc
complete -C /usr/local/bin/nomad nomad
-EOF
-\ No newline at end of file
+EOF
+
+# Mount NFS
+if [[ -n "$NFS_SERVER" ]]; then
+ mkdir -p "$NFS_MOUNT_TARGET"
+ # mount $NFS_SERVER:/$NFS_MOUNT $NFS_MOUNT_TARGET
+ cat << EOF >> /etc/fstab
+$NFS_SERVER:/$NFS_MOUNT $NFS_MOUNT_TARGET nfs defaults 0 0
+EOF
+fi
+\ No newline at end of file