Make any_errors_fatal configurable again (#13488)

The plays carry `any_errors_fatal: "{{ any_errors_fatal | default(true) }}"`,
added in #1201 so the behaviour could be turned off.

`any_errors_fatal` is an Ansible play keyword, and Ansible reserves keyword
names in the variable namespace. Setting it through -e, group_vars or
host_vars is rejected with "Found variable using reserved name:
any_errors_fatal" and the value never reaches the play, so the expression
always falls through to `default(true)`. The knob has been inert since it was
introduced.

Rename the variable to `kubespray_any_errors_fatal`. Default behaviour is
unchanged -- still fatal -- but `-e kubespray_any_errors_fatal=false` now
works as #1201 intended.

This matters most in playbooks/internal_facts.yml, where the fatal bootstrap
play runs ahead of the play that gathers and caches facts: one unreachable
host aborts the run before any facts are cached, the playbook still exits 0,
and a later `scale.yml --limit=...` refuses because the excluded hosts have
no cache entries. roles/network_facts already sets ignore_unreachable: true
for this reason, but it never executes.

Refs #13407

Claude-Session: https://claude.ai/code/session_017RCEoUNR9gthd455d8Anrx

Signed-off-by: Weigang Geng <3356786+gengwg@users.noreply.github.com>
Co-authored-by: Weigang Geng <3356786+gengwg@users.noreply.github.com>
This commit is contained in:
W Geng
2026-09-10 08:38:36 +00:00
committed by GitHub
co-authored by Weigang Geng
parent f6b046bcac
commit 65832d2e2e
6 changed files with 28 additions and 28 deletions
+4 -4
View File
@@ -19,7 +19,7 @@
- name: Bootstrap hosts OS for Ansible - name: Bootstrap hosts OS for Ansible
hosts: k8s_cluster:etcd:calico_rr hosts: k8s_cluster:etcd:calico_rr
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
gather_facts: false gather_facts: false
vars: vars:
# Need to disable pipelining for bootstrap_os as some systems have requiretty in sudoers set, which makes pipelining # Need to disable pipelining for bootstrap_os as some systems have requiretty in sudoers set, which makes pipelining
@@ -31,14 +31,14 @@
- name: Preinstall - name: Preinstall
hosts: k8s_cluster:etcd:calico_rr hosts: k8s_cluster:etcd:calico_rr
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
roles: roles:
- { role: kubespray_defaults} - { role: kubespray_defaults}
- { role: kubernetes/preinstall, tags: preinstall } - { role: kubernetes/preinstall, tags: preinstall }
- name: Handle upgrades to control plane components first to maintain backwards compat. - name: Handle upgrades to control plane components first to maintain backwards compat.
hosts: kube_control_plane hosts: kube_control_plane
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
serial: 1 serial: 1
roles: roles:
- { role: kubespray_defaults} - { role: kubespray_defaults}
@@ -51,7 +51,7 @@
- name: Finally handle worker upgrades, based on given batch size - name: Finally handle worker upgrades, based on given batch size
hosts: kube_node:!kube_control_plane hosts: kube_node:!kube_control_plane
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
serial: "{{ serial | default('20%') }}" serial: "{{ serial | default('20%') }}"
roles: roles:
- { role: kubespray_defaults} - { role: kubespray_defaults}
+8 -8
View File
@@ -8,7 +8,7 @@
- name: Prepare for etcd install - name: Prepare for etcd install
hosts: k8s_cluster:etcd hosts: k8s_cluster:etcd
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -25,7 +25,7 @@
- name: Install Kubernetes nodes - name: Install Kubernetes nodes
hosts: k8s_cluster hosts: k8s_cluster
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -34,7 +34,7 @@
- name: Install the control plane - name: Install the control plane
hosts: kube_control_plane hosts: kube_control_plane
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -45,7 +45,7 @@
- name: Invoke kubeadm and install a CNI - name: Invoke kubeadm and install a CNI
hosts: k8s_cluster hosts: k8s_cluster
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -58,7 +58,7 @@
- name: Install Calico Route Reflector - name: Install Calico Route Reflector
hosts: calico_rr hosts: calico_rr
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -67,7 +67,7 @@
- name: Patch Kubernetes for Windows - name: Patch Kubernetes for Windows
hosts: kube_control_plane[0] hosts: kube_control_plane[0]
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -76,7 +76,7 @@
- name: Install Kubernetes apps - name: Install Kubernetes apps
hosts: kube_control_plane hosts: kube_control_plane
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -89,7 +89,7 @@
- name: Apply resolv.conf changes now that cluster DNS is up - name: Apply resolv.conf changes now that cluster DNS is up
hosts: k8s_cluster hosts: k8s_cluster
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
+1 -1
View File
@@ -17,7 +17,7 @@
- name: Install etcd - name: Install etcd
hosts: etcd:kube_control_plane:_kubespray_needs_etcd hosts: etcd:kube_control_plane:_kubespray_needs_etcd
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
+1 -1
View File
@@ -2,7 +2,7 @@
- name: Bootstrap hosts for Ansible - name: Bootstrap hosts for Ansible
hosts: k8s_cluster:etcd:calico_rr hosts: k8s_cluster:etcd:calico_rr
strategy: linear strategy: linear
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
gather_facts: false gather_facts: false
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
+5 -5
View File
@@ -14,7 +14,7 @@
- name: Download images to ansible host cache via first kube_control_plane node - name: Download images to ansible host cache via first kube_control_plane node
hosts: kube_control_plane[0] hosts: kube_control_plane[0]
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults, when: "not skip_downloads and download_run_once and not download_localhost" } - { role: kubespray_defaults, when: "not skip_downloads and download_run_once and not download_localhost" }
@@ -24,7 +24,7 @@
- name: Target only workers to get kubelet installed and checking in on any new nodes(engine) - name: Target only workers to get kubelet installed and checking in on any new nodes(engine)
hosts: kube_node hosts: kube_node
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -43,7 +43,7 @@
- name: Target only workers to get kubelet installed and checking in on any new nodes(node) - name: Target only workers to get kubelet installed and checking in on any new nodes(node)
hosts: kube_node hosts: kube_node
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -74,7 +74,7 @@
- name: Target only workers to get kubelet installed and checking in on any new nodes(network) - name: Target only workers to get kubelet installed and checking in on any new nodes(network)
hosts: kube_node hosts: kube_node
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -86,7 +86,7 @@
- name: Apply resolv.conf changes now that cluster DNS is up - name: Apply resolv.conf changes now that cluster DNS is up
hosts: k8s_cluster hosts: k8s_cluster
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
+9 -9
View File
@@ -8,7 +8,7 @@
- name: Download images to ansible host cache via first kube_control_plane node - name: Download images to ansible host cache via first kube_control_plane node
hosts: kube_control_plane[0] hosts: kube_control_plane[0]
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults, when: "not skip_downloads and download_run_once and not download_localhost"} - { role: kubespray_defaults, when: "not skip_downloads and download_run_once and not download_localhost"}
@@ -18,7 +18,7 @@
- name: Prepare nodes for upgrade - name: Prepare nodes for upgrade
hosts: k8s_cluster:etcd:calico_rr hosts: k8s_cluster:etcd:calico_rr
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -28,7 +28,7 @@
- name: Upgrade container engine on non-cluster nodes - name: Upgrade container engine on non-cluster nodes
hosts: etcd:calico_rr:!k8s_cluster hosts: etcd:calico_rr:!k8s_cluster
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
serial: "{{ serial | default('20%') }}" serial: "{{ serial | default('20%') }}"
roles: roles:
@@ -44,7 +44,7 @@
- name: Handle upgrades to control plane components first to maintain backwards compat. - name: Handle upgrades to control plane components first to maintain backwards compat.
gather_facts: false gather_facts: false
hosts: kube_control_plane hosts: kube_control_plane
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
serial: 1 serial: 1
roles: roles:
@@ -66,7 +66,7 @@
- name: Upgrade calico and external cloud provider on all control plane nodes, calico-rrs, and nodes - name: Upgrade calico and external cloud provider on all control plane nodes, calico-rrs, and nodes
hosts: kube_control_plane:calico_rr:kube_node hosts: kube_control_plane:calico_rr:kube_node
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
serial: "{{ serial | default('20%') }}" serial: "{{ serial | default('20%') }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
@@ -78,7 +78,7 @@
- name: Finally handle worker upgrades, based on given batch size - name: Finally handle worker upgrades, based on given batch size
hosts: kube_node:calico_rr:!kube_control_plane hosts: kube_node:calico_rr:!kube_control_plane
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
serial: "{{ serial | default('20%') }}" serial: "{{ serial | default('20%') }}"
roles: roles:
@@ -105,7 +105,7 @@
- name: Install Calico Route Reflector - name: Install Calico Route Reflector
hosts: calico_rr hosts: calico_rr
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -114,7 +114,7 @@
- name: Install Kubernetes apps - name: Install Kubernetes apps
hosts: kube_control_plane hosts: kube_control_plane
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }
@@ -125,7 +125,7 @@
- name: Apply resolv.conf changes now that cluster DNS is up - name: Apply resolv.conf changes now that cluster DNS is up
hosts: k8s_cluster hosts: k8s_cluster
gather_facts: false gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" any_errors_fatal: "{{ kubespray_any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}" environment: "{{ proxy_disable_env }}"
roles: roles:
- { role: kubespray_defaults } - { role: kubespray_defaults }