diff --git a/tasks/k3s/install.yaml b/tasks/k3s/install.yaml index 25da808..6ab9f75 100644 --- a/tasks/k3s/install.yaml +++ b/tasks/k3s/install.yaml @@ -343,7 +343,7 @@ cmd: | INSTALL_K3S_SKIP_DOWNLOAD=true \ INSTALL_K3S_VERSION="v{{ KubernetesVersion }}{{ KubernetesVersion_k3s_prefix }}" \ - /tmp/install.sh --cluster-init + /tmp/install.sh {% if nfc_role_kubernetes_etcd_enabled %}--cluster-init{% endif %} changed_when: false when: > kubernetes_config.cluster.prime.name | default(inventory_hostname) == inventory_hostname diff --git a/templates/k3s-config.yaml.j2 b/templates/k3s-config.yaml.j2 index c0ccef7..4089176 100644 --- a/templates/k3s-config.yaml.j2 +++ b/templates/k3s-config.yaml.j2 @@ -29,13 +29,20 @@ "traefik" ], "disable-network-policy": true, - "etcd-snapshot-retention": kubernetes_etcd_snapshot_retention | int, - "etcd-snapshot-schedule-cron": kubernetes_etcd_snapshot_cron_schedule | string, "flannel-backend": "none", "service-cidr": nfc_role_kubernetes_service_subnet } -%} + {%- if nfc_role_kubernetes_etcd_enabled -%} + + {%- set servers_config = servers_config | combine({ + "etcd-snapshot-retention": kubernetes_etcd_snapshot_retention | int, + "etcd-snapshot-schedule-cron": kubernetes_etcd_snapshot_cron_schedule | string, + }) -%} + + {%- endif -%} + {%- if kubernetes_config.cluster.domain_name | default(nfc_role_kubernetes_cluster_domain) is defined and