-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
What happened?
The reset role fails when trying to restart active network services. The error occurs in two stages:
-
First, the "Gather active network services" task fails due to undefined ansible_os_family:
TASK [reset : Gather active network services] ********************************************************************************************************************************************************************** fatal: [metalhost1]: FAILED! => {"msg": "The conditional check 'ansible_os_family not in [\"Flatcar\", \"Flatcar Container Linux by Kinvolk\"]' failed. The error was: error while evaluating conditional (ansible_o s_family not in [\"Flatcar\", \"Flatcar Container Linux by Kinvolk\"]): 'ansible_os_family' is undefined. 'ansible_os_family' is undefined"} -
Then the "Restart active network services" task fails because the registered variable lacks the results attribute:
TASK [reset : Restart active network services] ********************************************************************************************************************************************************************* fatal: [metalhost1]: FAILED! => {"msg": "'dict object' has no attribute 'results'. 'dict object' has no attribute 'results'"}
What did you expect to happen?
The reset role should handle cases where facts are not gathered or the previous task fails, and continue without failing.
How can we reproduce it (as minimally and precisely as possible)?
Perhaps try running the reset playbook on a RHEL9 host.
OS
RHEL 9
Version of Ansible
N/A (using quay.io/kubespray/kubespray:v2.28.1)
Version of Python
N/A (using quay.io/kubespray/kubespray:v2.28.1)
Version of Kubespray (commit)
N/A (using quay.io/kubespray/kubespray:v2.28.1)
Network plugin used
cilium
Full inventory with variables
https://gist.github.com/broboa/f8a3e58165333ca127345532a32772af
Command used to invoke ansible
cd /kubespray && ansible-playbook -i /ansible/inventory/tf-osp-demo/hosts.yml -b remove-node.yml --extra-vars "node=metalhost1"
Output of ansible run
TASK [reset : Gather active network services] **********************************************************************************************************************************************************************
fatal: [metalhost1]: FAILED! => {"msg": "The conditional check 'ansible_os_family not in [\"Flatcar\", \"Flatcar Container Linux by Kinvolk\"]' failed. The error was: error while evaluating conditional (ansible_o
s_family not in [\"Flatcar\", \"Flatcar Container Linux by Kinvolk\"]): 'ansible_os_family' is undefined. 'ansible_os_family' is undefined"}
...ignoring
TASK [reset : Restart active network services] *********************************************************************************************************************************************************************
fatal: [metalhost1]: FAILED! => {"msg": "'dict object' has no attribute 'results'. 'dict object' has no attribute 'results'"}
Anything else we need to know
The root cause is that ansible_os_family is undefined when the reset role runs, causing the conditional check to fail. This results in the registered service_status variable being a dict without the expected
results attribute. Running ansible -i /ansible/inventory/tf-osp-demo/hosts.yml all -m debug -a "var=hostvars[inventory_hostname]" confirms that ansible_os_family is not available in the host variables.