What version are you running? The linux host is centos7.6

Verified in my facts

"ansible_ssh_host_key_ecdsa_public": 
"AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGpMZqjhIzo6gGjz4eczxnatrAgmPxdWVYf0zY29MDngkKuOzjB0bMrR5sQm1X6leGgYowv3wNloWOZVbhwPU2A=",
 

> On Jan 3, 2019, at 4:06 PM, Hugo Gonzalez <hgonz...@redhat.com> 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 ansible-project+unsubscr...@googlegroups.com 
>>> <mailto:ansible-project+unsubscr...@googlegroups.com>.
>>> To post to this group, send email to ansible-project@googlegroups.com 
>>> <mailto:ansible-project@googlegroups.com>.
>>> 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 
>>> <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 ansible-project+unsubscr...@googlegroups.com 
>> <mailto:ansible-project+unsubscr...@googlegroups.com>.
>> To post to this group, send email to ansible-project@googlegroups.com 
>> <mailto:ansible-project@googlegroups.com>.
>> 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 
>> <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 ansible-project+unsubscr...@googlegroups.com 
> <mailto:ansible-project+unsubscr...@googlegroups.com>.
> To post to this group, send email to ansible-project@googlegroups.com 
> <mailto:ansible-project@googlegroups.com>.
> 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 
> <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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/E1081AAA-47FF-4265-A5F9-93FE4835A79B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to