We have a Kubernetes cluster, deployed using Kubespray. It was working fine. We are trying to add one more worker node, and getting below error only on all worker nodes.
ansible-playbook -i hosts.ini test.yaml -b -K -v
test.yaml
---
- hosts: masternode1 workernode1
gather_facts: true
tasks:
- name: Gather host facts to get ansible_os_family
ansible.builtin.setup:
gather_subset: '!all'
filter: ansible_*
- name: Debug
debug:
var: ansible_os_family`
output of above:
PLAY [masternode1 workernode1] **********************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
ok: [masternode1]
ok: [workernode1]
TASK [Gather host facts to get ansible_os_family] *******************************************************************************************************************************************************************************************
ok: [masternode1]
ok: [workernode1]
TASK [Debug] ********************************************************************************************************************************************************************************************************************************
ok: [masternode1] => {
"ansible_os_family": "Debian"
}
ok: [workernode1] => {
"ansible_os_family": "VARIABLE IS NOT DEFINED!: 'ansible_os_family' is undefined"
}
PLAY RECAP **********************************************************************************************************************************************************************************************************************************
masternode1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
workernode1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
debug: ansible_facts, missing below details on workernode
"distribution": "Ubuntu",
"distribution_file_parsed": true,
"distribution_file_path": "/etc/os-release",
"distribution_file_variety": "Debian",
"distribution_major_version": "20",
"distribution_release": "focal",
"distribution_version": "20.04",
"os_family": "Debian",
"pkg_mgr": "apt"
There is an error using -vvv option on workernode
UnboundLocalError("local variable \'datafile\' referenced before assignment")\r\nKeyError(\'ansible_os_family\')
Also tried ansible.builtin.setup
, but worker nodes doesn't return os_family
or any distribution*
variables, while all master nodes are fine; gather_facts
doesn't help.
Ansible version 2.12 (also tried version 2.10.6 but same issue) OS Ubuntu 20.04