Hello,

I wrote a playbook that checks out brand new servers that are built for my 
team.  To make things truly one-and-done, I thought it would be clever to 
include a play that copies the ssh public key from our ansible controller 
to the freshly built remote hosts.

I tried using the authorized_key module, but it doesn't seem to work..

Here is the play:

---
- name: Checkout new build
  hosts: all
  remote_user: blah
  tasks:
  - name: copy ssh key to remote host
    authorized_key:
      user: blah
      key: "{{ lookup('file', '/home/blah/.ssh/id_rsa.pub') }}"


Here is the error I get:

TASK [setup] 
*******************************************************************
fatal: [hostname redacted]: UNREACHABLE! => {"changed": false, "msg": 
"ERROR! SSH encountered an unknown error during the connection. We 
recommend you re-run the command using -vvvv, which will enable SSH 
debugging output to help diagnose the issue", "unreachable": true}

Here is the command I am running:

ansible-playbook -i /home/blah/ansible/inventory/newBuilds.hosts 
/home/blah/ansible/playbooks/linuxCheckout/linuxCheckout.yml --ask-pass


Am I doing something wrong?

Best regards,

-C

-- 
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/52be1e8d-ccec-4241-bc18-98e1ede7b77c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to