From addf44c39fc9e1f20e18b320d1d5fd1fc8dae1d9 Mon Sep 17 00:00:00 2001 From: Karim Naufal Date: Wed, 16 Feb 2022 05:27:52 +0100 Subject: [PATCH] k3s install method ok --- locals.tf | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/locals.tf b/locals.tf index b6085bc..e9a90ac 100644 --- a/locals.tf +++ b/locals.tf @@ -35,27 +35,17 @@ locals { "umount /mnt" ] - install_k3s_server = [ + common_commands_install_k3s = [ "set -ex", # first we disable automatic reboot (after transactional updates), and configure the reboot method as kured "rebootmgrctl set-strategy off && echo 'REBOOT_METHOD=kured' > /etc/transactional-update.conf", # prepare the k3s config directory "mkdir -p /etc/rancher/k3s", # move the config file into place - "mv /tmp/config.yaml /etc/rancher/k3s/config.yaml", - # install k3s server - "curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=server sh -", + "mv /tmp/config.yaml /etc/rancher/k3s/config.yaml" ] - install_k3s_agent = [ - "set -ex", - # first we disable automatic reboot (after transactional updates), and configure the reboot method as kured - "rebootmgrctl set-strategy off && echo 'REBOOT_METHOD=kured' > /etc/transactional-update.conf", - # prepare the k3s config directory - "mkdir -p /etc/rancher/k3s", - # move the config file into place - "mv /tmp/config.yaml /etc/rancher/k3s/config.yaml", - # install k3s server - "curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=agent sh -", - ] + install_k3s_server = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=server sh -"]) + + install_k3s_agent = concat(local.common_commands_install_k3s, ["curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=agent sh -"]) }