diff --git a/README.md b/README.md index 1cbb81f..63dced8 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ For each agent, you will need to provide: - the agent node's hardware address - its IPv4 address - a UUID for a partition containing an ext4 filesystem for `K3S` persistent local storage +- an optional UUID for a swap partition - its PXE client ID - any extra args for K3s that the agent might need (optional) diff --git a/agents/README.md b/agents/README.md index 7b3c0fc..058444c 100644 --- a/agents/README.md +++ b/agents/README.md @@ -10,6 +10,7 @@ Example agent description file: AGENT_ETHERNET=b8:27:eb:81:1a:52 AGENT_IP=192.168.64.65 AGENT_RANCHER_PART_UUID=d5f9e6c2-493c-48da-baf2-0c63dd7a36b1 +AGENT_SWAP_PART_UUID=e5f9e6c2-493c-48da-baf2-0c63dd7a36b2 AGENT_PXE_ID=c6811a52 AGENT_K3S_ARGS="--node-label 'smarter-device-manager=enabled'" ``` diff --git a/scripts/configure-agent.sh b/scripts/configure-agent.sh index 4783dbb..34e37ed 100755 --- a/scripts/configure-agent.sh +++ b/scripts/configure-agent.sh @@ -108,6 +108,12 @@ ${LC_INTERNAL_IP}:${MOUNT_DIR}/${AGENT} / nfs defaults 0 0 UUID="${AGENT_RANCHER_PART_UUID}" ${RANCHERSTORAGEPATH} ext4 defaults 0 0 EOF +if [ ! -z ${AGENT_SWAP_PART_UUID} ]; then + cat - >> ${AGENT_ROOT}/etc/fstab << EOF +UUID="${AGENT_SWAP_PART_UUID}" none swap sw 0 0 +EOF +fi + ### CREATE AGENT DNSMASQ ENTRY cat - > ${ROOT_MNT}/etc/dnsmasq.d/20-scooby-agent-${AGENT} << EOF dhcp-host=net:${AGENT},${AGENT_ETHERNET},${AGENT},${AGENT_IP},24h @@ -148,6 +154,7 @@ configureAgents() { FSID=1 for FILE in $(cd ${AGENT_DIR}; ls *.agent) do + AGENT_SWAP_PART_UUID="" . ${AGENT_DIR}/${FILE} configureAgent $(printf "${FILE}" | grep -oE "^[a-z0-9\-]+") FSID=$((FSID+1))