On Friday, May 29, 2015 at 8:36:38 AM UTC-4, Leon Xie wrote:
>
> Hi all,
>
> I use the below playbook to add known hosts:
>
> ============================================================
> - name: demo
> hosts: 10.223.0.51
> remote_user: root
> tasks:
> - name: fetch
> fetch: src=/etc/ssh/ssh_host_rsa_key.pub dest=/tmp/keys
> fail_on_missing=yes validate_checksum=yes
> - name: demo
> hosts: 10.223.0.52
> remote_user: root
> tasks:
> - name: known_hosts
> known_hosts: path="/home/xiaoliang/.ssh/known_hosts"
> host="sun1-db-1" state=present
> key="{{ lookup('file', '/tmp/keys/
> 10.223.0.51/etc/ssh/ssh_host_rsa_key.pub') }}"
>
> The format of the key has to be in the form that it appears in a
known_hosts file. So ssh to the target system, verify and accept the key,
then take the line added to your local known_hosts file and add that.
--
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/c9221556-925e-4862-ad3c-d60ebe811766%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.