From 8b9cd3959aba10ded8c619c8d32ceddd0e7aa769 Mon Sep 17 00:00:00 2001 From: Eugene Artemenko Date: Tue, 4 Oct 2022 16:26:16 +0300 Subject: [PATCH] Add possibility to skip adding load balancer name in the hosts file (#9331) --- roles/kubernetes/preinstall/defaults/main.yml | 2 ++ roles/kubernetes/preinstall/tasks/0090-etchosts.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/roles/kubernetes/preinstall/defaults/main.yml b/roles/kubernetes/preinstall/defaults/main.yml index e06485101..5537b52b8 100644 --- a/roles/kubernetes/preinstall/defaults/main.yml +++ b/roles/kubernetes/preinstall/defaults/main.yml @@ -36,6 +36,8 @@ resolveconf_cloud_init_conf: /etc/resolveconf_cloud_init.conf # All inventory hostnames will be written into each /etc/hosts file. populate_inventory_to_hosts_file: true +# K8S Api FQDN will be written into /etc/hosts file. +populate_loadbalancer_apiserver_to_hosts_file: true sysctl_file_path: "/etc/sysctl.d/99-sysctl.conf" diff --git a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml index 693e31f54..ae4ffadd6 100644 --- a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml +++ b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml @@ -35,6 +35,7 @@ backup: yes unsafe_writes: yes when: + - populate_loadbalancer_apiserver_to_hosts_file - loadbalancer_apiserver is defined - loadbalancer_apiserver.address is defined