Your version has double quotes around the second line. The known working
version does not. Could that be an issue?

Regards, K.

On Fri, Jan 4, 2019 at 10:20 AM Freddie Eisa <[email protected]> wrote:

> I just ran the same thing you ddi with the same issue I had.
>
> On Jan 3, 2019, at 4:06 PM, Hugo Gonzalez <[email protected]> wrote:
>
> Got to be something else. Are these linux hosts?
>
> I tried this and it works:
>
> playbook:
>
> ---
> - hosts: all
>
>   tasks:
>     - template:
>         src: template.j2
>         dest: /tmp/knownhosts
>
> --------------------
>
> template:
>
> {% for host in groups['all'] %}
> {{ hostvars[host]['ansible_facts']['ssh_host_key_ecdsa_public'] }}
> {% endfor %}
>
> ----------------------
>
> I suggest you run the setup module on your managed hosts and see the
> structure of the facts on your hosts then, and see if the host keys are
> there with that name.
>
>
> Hugo G.
>
>
> On 1/3/19 4:33 PM, Freddie Eisa wrote:
>
> This is what I’m running
>
> My role
> - name: Template Knownhosts
>   template: src=./ssh_key.j2 dest=/tmp/temp.conf
>
> My template
> {% for host in groups['all'] %}
>    "{{ hostvars[host]['ansible_facts']['ssh_host_key_ecdsa_public'] }}"
> {% endfor %}
>
> My playbook
>
> ---
> - name: Centos 7 Servers
>   hosts: servers_all
>   gather_facts: True
>   ignore_errors: yes
>   roles:
>    - linux-role
>
>
> --
> HUGO F. GONZALEZ
>
> SENIOR CONSULTANT
> Red Hat LATAM <https://www.redhat.com/>
> <https://red.ht/sig>
>
> --
> 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/51fe343a-0562-0849-9161-4a0d04366503%40redhat.com
> <https://groups.google.com/d/msgid/ansible-project/51fe343a-0562-0849-9161-4a0d04366503%40redhat.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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/4B57DC00-7EAD-4209-97FA-C75F30038649%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/4B57DC00-7EAD-4209-97FA-C75F30038649%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> HUGO F. GONZALEZ
>
> SENIOR CONSULTANT
> Red Hat LATAM <https://www.redhat.com/>
> <https://red.ht/sig>
>
> --
> 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/8feca239-8c6b-4ef8-8331-4d26489f125c%40redhat.com
> <https://groups.google.com/d/msgid/ansible-project/8feca239-8c6b-4ef8-8331-4d26489f125c%40redhat.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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/A7231E7C-CA93-44B8-BCCD-A0862C691B18%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/A7231E7C-CA93-44B8-BCCD-A0862C691B18%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Karl Auer

Email  : [email protected]
Website: http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

-- 
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/CA%2B%2BT08RcnnB79%2BTjdZXZxh%2BTHYTbxy9WmdLBHuK5tsmq7dT0sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to