Skip to content

Commit

Permalink
playbooks: bootstrap in facts playbook (kubernetes-sigs#10069)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
MrFreezeex authored and pedromcpedro committed May 8, 2024
1 parent f0b80d9 commit 6c3e666
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 32 deletions.
9 changes: 0 additions & 9 deletions playbooks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions playbooks/facts.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 0 additions & 10 deletions playbooks/scale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions playbooks/upgrade_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c3e666

Please sign in to comment.