From 0e51a738ab05888ced9b6e48496804e4d145a824 Mon Sep 17 00:00:00 2001 From: Ashley Dumaine Date: Tue, 27 Feb 2024 15:49:59 -0500 Subject: [PATCH] need to set the hostname for rke2 --- templates/flavors/rke2/rke2ConfigTemplate.yaml | 1 + templates/flavors/rke2/rke2ControlPlane.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/flavors/rke2/rke2ConfigTemplate.yaml b/templates/flavors/rke2/rke2ConfigTemplate.yaml index c99c289da..5a48766de 100644 --- a/templates/flavors/rke2/rke2ConfigTemplate.yaml +++ b/templates/flavors/rke2/rke2ConfigTemplate.yaml @@ -17,3 +17,4 @@ spec: echo "node-ip: $(hostname -I | grep -oE 192\.168\.[0-9]+\.[0-9]+)" >> /etc/rancher/rke2/config.yaml.d/capi-config.yaml - sed -i '/swap/d' /etc/fstab - swapoff -a + - hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname diff --git a/templates/flavors/rke2/rke2ControlPlane.yaml b/templates/flavors/rke2/rke2ControlPlane.yaml index 9c1daf7cc..549be46c3 100644 --- a/templates/flavors/rke2/rke2ControlPlane.yaml +++ b/templates/flavors/rke2/rke2ControlPlane.yaml @@ -37,4 +37,5 @@ spec: echo "node-ip: $(hostname -I | grep -oE 192\.168\.[0-9]+\.[0-9]+)" >> /etc/rancher/rke2/config.yaml.d/capi-config.yaml - sed -i '/swap/d' /etc/fstab - swapoff -a + - hostnamectl set-hostname '{{ ds.meta_data.label }}' && hostname -F /etc/hostname replicas: ${CONTROL_PLANE_MACHINE_COUNT}