'Ansible - i get ansibleUndefinedVariable no attribute

Tries to use the playbook:

https://github.com/puzzle/ansible-rancher

My ansible version 2.9.12

My playbook crashes in the role of:

roles/rke_rancher_clusters/tasks/rke-config.yml

---
- name: Create RKE Config
  template:
    src: cluster.yml.j2
    dest: "{{ rke_cluster_config }}"
    mode: 0666
  vars:
    cluster: "{{ groups['rke_' + inventory_hostname] }}"
  changed_when: false


cluster.yml.j2

nodes:
{% for node in cluster %}
  - address: {{ hostvars[node]['ansible_' + rke_network_interface]['ipv4']['address'] }}
    internal_address: {{ hostvars[node]['ansible_' + rke_network_interface]['ipv4']['address'] }}
    user: {{ rke_ssh_user }}
    role: [{% for role in hostvars[node]['k8s_roles'] %}{{ role }},{% endfor %}]

{% endfor %}

I get:

fatal: [app01.rancher.dev -> localhost]: FAILED! => changed=false 
  msg: 'AnsibleUndefinedVariable: ''dict object'' has no attribute u''rke_app01.rancher.dev'''

But i cannot find the cause of the problem.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source