Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to remove worker node with error undefined variable ansible_hostname #7798

Closed
tandrez opened this issue Jul 12, 2021 · 5 comments · May be fixed by 1Const1/kubespray#1
Closed

Failed to remove worker node with error undefined variable ansible_hostname #7798

tandrez opened this issue Jul 12, 2021 · 5 comments · May be fixed by 1Const1/kubespray#1
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@tandrez
Copy link

tandrez commented Jul 12, 2021

Hello,

Environment:

  • Cloud provider or hardware configuration: Hosted VM

  • OS (printf "$(uname -srm)\n$(cat /etc/os-release)\n"): CentOS 7.8

  • Version of Ansible (ansible --version): 2.9.6

  • Version of Python (python --version): 3.9.4

Kubespray version (commit) (git rev-parse --short HEAD): branch release-2.13 commit cd832ead

Network plugin used: Calico

Full inventory with variables (ansible -i inventory/sample/inventory.ini all -m debug -a "var=hostvars[inventory_hostname]"):

[all:vars]
ansible_user=ansible
ansible_become=true
ansible_become_password="{{ vault_ansible_password }}"

[all]
localhost              ansible_connection=local             ansible_become=false   ansible_python_interpreter="{{ansible_playbook_python}}"
sc2-k8sm-01	       ansible_host=172.XXX.XXX.11           ip=172.XXX.XXX.11       etcd_member_name=etcd1
sc2-k8sm-02	       ansible_host=172.XXX.XXX.12           ip=172.XXX.XXX.12       etcd_member_name=etcd2
sc1-k8sm-03	       ansible_host=172.XXX.XXX.13           ip=172.XXX.XXX.13       etcd_member_name=etcd3
sc2-k8sn-01	       ansible_host=172.XXX.XXX.21           ip=172.XXX.XXX.21       
sc2-k8sn-02	       ansible_host=172.XXX.XXX.22           ip=172.XXX.XXX.22       
sc2-k8sn-03	       ansible_host=172.XXX.XXX.23           ip=172.XXX.XXX.23       
sc1-k8sn-04	       ansible_host=172.XXX.XXX.24           ip=172.XXX.XXX.24       
sc1-k8sn-05	       ansible_host=172.XXX.XXX.25           ip=172.XXX.XXX.25       
sc1-k8sn-06	       ansible_host=172.XXX.XXX.26           ip=172.XXX.XXX.26       
sc2-k8sn-07	       ansible_host=172.XXX.XXX.27           ip=172.XXX.XXX.27       

[kube-master]
sc2-k8sm-01
sc2-k8sm-02
sc1-k8sm-03

[etcd]
sc2-k8sm-01
sc2-k8sm-02
sc1-k8sm-03

[kube-node]
sc2-k8sn-01
sc2-k8sn-02
sc2-k8sn-03
sc1-k8sn-04
sc1-k8sn-05
sc1-k8sn-06
sc2-k8sn-07

[calico-rr]

[k8s-cluster:children]
kube-master
kube-node
calico-rr

[k8s:children]
k8s-cluster
etcd

Command used to invoke ansible:
ansible-playbook -i ../../environment/preprod/ansible/inventory.ini -e '@../../environment/preprod/ansible/vault.yml' --vault-password-file ../../secrets/preprod/ansible-vault.txt roles/kubespray/remove-node.yml -e node=sc2-k8sn-07

Output of ansible run:

TASK [kubespray-defaults : Set no_proxy to all assigned cluster IPs and hostnames] ****************************************************************************************************** fatal: [sc2-k8sm-01]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_hostname'\n\nThe error appears to be in 'kubespray/roles/kubespray-defaults/tasks/no_proxy.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Set no_proxy to all assigned cluster IPs and hostnames\n ^ here\n"}

Thanks for your help !

@tandrez tandrez added the kind/bug Categorizes issue or PR as related to a bug. label Jul 12, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 10, 2021
1Const1 added a commit to 1Const1/kubespray that referenced this issue Nov 3, 2021
fix 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_os_family not in [\"Flatcar\", \"Flatcar Container Linux by Kinvolk\"])

kubernetes-sigs#8090
kubernetes-sigs#7798
kubernetes-sigs#8009
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 9, 2021
@maxpain
Copy link
Contributor

maxpain commented Nov 28, 2021

Any updates?

@oomichi
Copy link
Contributor

oomichi commented Dec 7, 2021

This issue has been fixed with #8231

/close

@k8s-ci-robot
Copy link
Contributor

@oomichi: Closing this issue.

In response to this:

This issue has been fixed with #8231

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
5 participants