From c55844b80e6c66131c39dbbbbe8bcf3b219c8993 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> Date: Tue, 23 May 2023 09:18:28 +0200 Subject: [PATCH] playbooks: bootstrap in facts playbook (#10069) Calling bootstrap in facts.yaml so that we can always collect facts even on new nodes. This is useful when you want to add nodes to an inventory beforehand and then collect facts and scale the cluster with the scale playbook and --limits. With dynamic inventory sometimes it might be more difficult to add the nodes after running the facts playbook in this specific situation. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --- playbooks/cluster.yml | 9 --------- playbooks/facts.yml | 13 +++++++++++++ playbooks/scale.yml | 10 ---------- playbooks/upgrade_cluster.yml | 13 ------------- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/playbooks/cluster.yml b/playbooks/cluster.yml index 81da5be46..6e61459a1 100644 --- a/playbooks/cluster.yml +++ b/playbooks/cluster.yml @@ -12,15 +12,6 @@ - { role: kubespray-defaults } - { role: bastion-ssh-config, tags: ["localhost", "bastion"] } -- hosts: k8s_cluster:etcd - strategy: linear - any_errors_fatal: "{{ any_errors_fatal | default(true) }}" - gather_facts: false - environment: "{{ proxy_disable_env }}" - roles: - - { role: kubespray-defaults } - - { role: bootstrap-os, tags: bootstrap-os} - - name: Gather facts tags: always import_playbook: facts.yml diff --git a/playbooks/facts.yml b/playbooks/facts.yml index d9ce34081..4fff54f11 100644 --- a/playbooks/facts.yml +++ b/playbooks/facts.yml @@ -1,4 +1,17 @@ --- +- hosts: k8s_cluster:etcd:calico_rr + strategy: linear + any_errors_fatal: "{{ any_errors_fatal | default(true) }}" + gather_facts: false + environment: "{{ proxy_disable_env }}" + vars: + # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining + # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled. + ansible_ssh_pipelining: false + roles: + - { role: kubespray-defaults } + - { role: bootstrap-os, tags: bootstrap-os} + - name: Gather facts hosts: k8s_cluster:etcd:calico_rr gather_facts: False diff --git a/playbooks/scale.yml b/playbooks/scale.yml index 8e79bfa03..4d95543b8 100644 --- a/playbooks/scale.yml +++ b/playbooks/scale.yml @@ -12,16 +12,6 @@ - { role: kubespray-defaults } - { role: bastion-ssh-config, tags: ["localhost", "bastion"] } -- name: Bootstrap any new workers - hosts: kube_node - strategy: linear - any_errors_fatal: "{{ any_errors_fatal | default(true) }}" - gather_facts: false - environment: "{{ proxy_disable_env }}" - roles: - - { role: kubespray-defaults } - - { role: bootstrap-os, tags: bootstrap-os } - - name: Gather facts tags: always import_playbook: facts.yml diff --git a/playbooks/upgrade_cluster.yml b/playbooks/upgrade_cluster.yml index 15809e845..96a8feb45 100644 --- a/playbooks/upgrade_cluster.yml +++ b/playbooks/upgrade_cluster.yml @@ -12,19 +12,6 @@ - { role: kubespray-defaults } - { role: bastion-ssh-config, tags: ["localhost", "bastion"] } -- hosts: k8s_cluster:etcd:calico_rr - strategy: linear - any_errors_fatal: "{{ any_errors_fatal | default(true) }}" - gather_facts: false - environment: "{{ proxy_disable_env }}" - vars: - # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining - # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled. - ansible_ssh_pipelining: false - roles: - - { role: kubespray-defaults } - - { role: bootstrap-os, tags: bootstrap-os} - - name: Gather facts tags: always import_playbook: facts.yml -- GitLab