Can you try removing the "

ignore_errors:yes
"you had before? Maybe something in failing in the facts gathering and, naturally, the variables did not get populated.


Here's the full playbook and template I used to test (this does not even need to escalate privileges):

---
- hosts: all

  tasks:

    - name: Render the known_hosts file locally
      template:
        src: template.j2
        dest: /tmp/known_hosts
      delegate_to: localhost
      run_once: true

    - name: Copy the rendered file to all the nodes
      copy:
        src: /tmp/known_hosts
        dest: /tmp


Template:

{% for host in groups['all'] %}
{{ hostvars[host]['ansible_ssh_host_key_ecdsa_public'] }}
{% endfor %}





On 1/7/19 10:30 AM, Freddie Eisa wrote:
Same error, can you send full playbook details over you are testing?

localhost]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_ssh_host_key_ecdsa_public'"}

On Jan 4, 2019, at 11:47 AM, Hugo Gonzalez <[email protected] <mailto:[email protected]>> wrote:


--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3eaa0eef-e547-f758-5c96-55276770f967%40redhat.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to