From 9921cfab2de232af48d4b77d0075d48859f31800 Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Fri, 24 Dec 2021 18:17:24 +0700 Subject: [PATCH] style(k3s): get config from default instead of hard code --- metal/roles/k3s/defaults/main.yml | 7 +++++++ metal/roles/k3s/templates/config.yaml.j2 | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/metal/roles/k3s/defaults/main.yml b/metal/roles/k3s/defaults/main.yml index 5b7993b9..9a65b4c3 100644 --- a/metal/roles/k3s/defaults/main.yml +++ b/metal/roles/k3s/defaults/main.yml @@ -2,3 +2,10 @@ k3s_version: v1.22.2+k3s2 k3s_config_file: /etc/rancher/k3s/config.yaml k3s_token_file: /etc/rancher/node/password k3s_service_file: /etc/systemd/system/k3s.service +k3s_server_config: + disable: + - local-storage + - servicelb + - traefik + disable-cloud-controller: true + secrets-encryption: true diff --git a/metal/roles/k3s/templates/config.yaml.j2 b/metal/roles/k3s/templates/config.yaml.j2 index d6d5f75c..361ae44f 100644 --- a/metal/roles/k3s/templates/config.yaml.j2 +++ b/metal/roles/k3s/templates/config.yaml.j2 @@ -5,10 +5,5 @@ server: https://{{ hostvars[groups['masters'][0]].ansible_host }}:6443 {% endif %} token-file: {{ k3s_token_file }} {% if 'masters' in group_names %} -disable-cloud-controller: true -disable: -- local-storage -- servicelb -- traefik -secrets-encryption: true +{{ k3s_server_config | to_nice_yaml }} {% endif %}