copy module && permissions

Hello,

It seems I have permissioning issues, but cannot seem to get it right when using the copy module.

Using the command module, this works fine: “sudo cp /home/jedelman/.ssh/authorized_keys /root/.ssh/”

Using the copy module, this does not work: “src=/home/jedelman/.ssh/authorized_keys dest=/root/.ssh/”

!!!

Error shown with -vvvv:

TASK: [copy auth keys] ********************************************************
<192.168.1.51> ESTABLISH CONNECTION FOR USER: root
failed: [192.168.1.51] => {“failed”: true}
msg: could not find src=/home/jedelman/.ssh/authorized_keys

FATAL: all hosts have already failed – aborting

!!!

remote_user: root …is being used (FYI- I can login with root@x.x.x.x with no password just fine and issue “cp /home/jedelman/.ssh/authorized_keys /root/.ssh/” and just fine.

!!!

I’ve been messing with the permissions, but here is where they are now:
!!!

root@s1-1:/home/jedelman# ls -l .ssh
total 8
-rwx------ 1 root root 1191 Jul 4 10:06 authorized_keys

Initially jedelman/jedelman was group/owner, but like I said, been trying to get this to work.

!!!

root@s1-1:/home/jedelman# ls -ld .ssh
drw-rw-r-- 2 root root 4096 Jul 3 14:30 .ssh

!!!

root@s1-1:/home/jedelman# ls -la
total 180
drwxr-xr-x 24 jedelman jedelman 4096 Jul 3 14:28 .
drwxr-xr-x 3 root root 4096 Jul 2 16:32 …
drwxrwxr-x 3 jedelman jedelman 4096 Jul 3 14:28 .ansible
-rw------- 1 jedelman jedelman 476 Jul 4 10:18 .bash_history
-rw-r–r-- 1 jedelman jedelman 220 Jul 2 16:32 .bash_logout
-rw-r–r-- 1 jedelman jedelman 3486 Jul 2 16:32 .bashrc
drwx------ 15 jedelman jedelman 4096 Jul 3 09:51 .cache
drwx------ 3 jedelman jedelman 4096 Jul 2 16:38 .compiz
drwx------ 10 jedelman jedelman 4096 Jul 2 21:11 .config
drwxrwxr-x 2 jedelman jedelman 4096 Jul 4 10:34 configs
drwx------ 3 jedelman jedelman 4096 Jul 2 16:38 .dbus
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Desktop
-rw-r–r-- 1 jedelman jedelman 25 Jul 3 10:54 .dmrc
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Documents
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Downloads
-rw-r–r-- 1 jedelman jedelman 8445 Jul 2 16:32 examples.desktop
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 21:02 .fontconfig
drwx------ 4 jedelman jedelman 4096 Jul 3 10:54 .gconf
drwx------ 4 jedelman jedelman 4096 Jul 2 16:38 .gnome2
-rw------- 1 jedelman jedelman 0 Jul 2 16:38 .goutputstream-7FVRIX
-rw------- 1 jedelman jedelman 0 Jul 2 21:07 .goutputstream-T73BIX
-rw-rw-r-- 1 jedelman jedelman 152 Jul 3 10:54 .gtk-bookmarks
drwx------ 2 jedelman jedelman 4096 Jul 2 16:38 .gvfs
-rw------- 1 jedelman jedelman 1518 Jul 3 10:54 .ICEauthority
drwxr-xr-x 3 jedelman jedelman 4096 Jul 2 16:38 .local
drwx------ 3 jedelman jedelman 4096 Jul 2 16:38 .mission-control
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Music
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Pictures
-rw-r–r-- 1 jedelman jedelman 675 Jul 2 16:32 .profile
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Public
drwx------ 2 jedelman jedelman 4096 Jul 3 10:54 .pulse
-rw------- 1 jedelman jedelman 256 Jul 2 16:38 .pulse-cookie
drw-rw-r-- 2 root root 4096 Jul 3 14:30 .ssh
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Templates
drwxr-xr-x 2 jedelman jedelman 4096 Jul 2 16:38 Videos
-rw------- 1 root root 740 Jul 3 10:50 .viminfo
-rw------- 1 jedelman jedelman 49 Jul 3 10:54 .Xauthority
-rw------- 1 jedelman jedelman 9461 Jul 3 10:54 .xsession-errors
-rw------- 1 jedelman jedelman 18224 Jul 3 10:50 .xsession-errors.old
root@s1-1:/home/jedelman#

Any help would be greatly appreciated.

Thanks,
Jason

copy src needs to exist on the machine you execute ansible from (master)
not on the target host. The reason the command module works is because it
ALL gets executed on the target machine. copy is meant to be done ACROSS
hosts, not on single host.

WOW, thank you, and it states it right in the synopsis in the copy module. I feel great. Is there another more “Ansibley” way to do what I’m trying to accomplish or is command module the best way ?

command or shell, there is also the syncronize module that might work with
delegate_to, but command might be simplest to use.