They keys are there in facts > 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] >>> <mailto:[email protected]>. >>> To post to this group, send email to [email protected] >>> <mailto:[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 >>> <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] >> <mailto:[email protected]>. >> To post to this group, send email to [email protected] >> <mailto:[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 >> <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] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[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 > <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/C53CF09D-DF49-41A3-8585-4911AC3A1264%40gmail.com. For more options, visit https://groups.google.com/d/optout.
