Unable to copy keys from management server to remote server

116 views
Skip to first unread message

Raj Desikavinayagompillai

unread,
Apr 27, 2015, 5:38:52 PM4/27/15
to ansible...@googlegroups.com

Hello,

Following was the error message. Playbook creates the user but does not copy the keys from management server to destination server. 

Am I missing something here?

 ansible-playbook -vvvvv /etc/ansible/site.yml

msg: could not find src=/home/dummyuser1/.ssh/authorized_keys


# master playbook file: site.yml

- hosts: ansible_slaves

  remote_user: ansible

  tasks:

   - name: Add test user

     user:

       name=dummyuser

       password='dummyuser’

       groups=ansible

       shell=/bin/bash

       append=yes

   - name: creates the .ssh directory

     file: path=/home/dummyuser/.ssh state=directory

   - name: Copying ssh key files

     copy:

       src=/home/dummyuser1/.ssh/authorized_keys dest=/home/dummyuser/.ssh/authorized_keys owner=dummyuser group=ansible mode=600               

  sudo: yes

Raj Desikavinayagompillai

unread,
Apr 27, 2015, 8:13:59 PM4/27/15
to ansible...@googlegroups.com
Hello,
This is due to a permission issue in the management server. To test it, I copied the file to /tmp and checked and it worked.

Now to fix this permanently, how do I have sudo for "src". This is the reason it is not working.


Thanks
dnraj


On Monday, April 27, 2015 at 2:38:52 PM UTC-7, Raj Desikavinayagompillai wrote:

Hello,

Following was the error message. Playbook creates the user but does not copy the keys from management server to destination server. 

Am I missing something here?

 ansible-playbook -vvvvv /etc/ansible/site.yml

msg: could not find src=/home/dummyuser1/.ssh/authorized_keys


# master playbook file: site.yml

- hosts: ansible_slaves

  remote_user: ansible

  tasks:

   - name: Add test user

     user:

       name=dummyuser

       password='dummyuser’

       groups=ansible

       shell=/bin/bash

       append=yes

   - name: creates the .ssh directory

...

Brian Coca

unread,
Apr 27, 2015, 8:15:32 PM4/27/15
to ansible...@googlegroups.com
sudo ansible-playbook ....


or use a local action with sudo: true that copies the key to temporary
spot for you to be able to use with copy.



--
Brian Coca

Raj Desikavinayagompillai

unread,
Apr 27, 2015, 8:24:25 PM4/27/15
to ansible...@googlegroups.com
Hello brian,
Thanks and it is working now.

thanks
dnraj


--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/d5WVzXRhDME/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8%3Dht-kqNKyFJHig2svE9uD6EeHgtp%2BhFazr2YeXK9AubQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages