-
Notifications
You must be signed in to change notification settings - Fork 196
Description
Summary
When i try to restore newly deployed cluster from s3 backup task that gathers all rke2_node_name from inventories is failing. In debug mode i can see that vars are gathered also from localhost which is not using this variable since it is not in rke2_cluster_group_name which in my case is k8s_cluster. I am setting all rke2 setting in group_vars/k8s_cluster/rke2.yaml so group_vars/all/main.yaml files has no rke2 settings at all.
The related task is here: to
ansible-role-rke2/tasks/first_server.yml
Lines 169 to 173 in 602b420
| - name: Get all node names | |
| ansible.builtin.set_fact: | |
| node_names: "{{ hostvars | dict2items | map(attribute='value.rke2_node_name') }}" | |
| run_once: true | |
| register: node_names |
Issue Type
Bug Report
Ansible Version
ansible [core 2.17.12]
config file = /Users/michal/platform-infra/ansible/ansible.cfg
configured module search path = ['/Users/michal/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/michal/.pyenv/versions/3.13.3/envs/platform/lib/python3.13/site-packages/ansible
ansible collection location = /Users/michal/.ansible/collections:/usr/share/ansible/collections:/Users/michal/platform-infra/ansible/collections
executable location = /Users/michal/.pyenv/versions/platform/bin/ansible
python version = 3.13.3 (main, May 5 2025, 13:28:27) [Clang 17.0.0 (clang-1700.0.13.3)] (/Users/michal/.pyenv/versions/3.13.3/envs/platform/bin/python)
jinja version = 3.1.6
libyaml = TrueSteps to Reproduce
backup etcd (to s3 or local), provision new nodes, configure restore parameters and use previous backup with playbook
Expected Results
Module gathers all current inventory node names from rke2_cluster_group_name group
Actual Results
15:44:12 TASK [lablabs.rke2 : Get all node names] ***************************************
15:44:16 fatal: [dev-02-node01]: FAILED! =>
15:44:16 msg: |-
15:44:16 The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'rke2_node_name'. 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'rke2_node_name'