Hello,
In my ansible inventory, I have VMs on localhost defined:
myvm ansible_port=15022 ansible_host=127.0.0.1 ansible_user=tibco
I’m trying to synchronize a local directory from the control host (running ansible) to ‘myvm
’ but this fails since it seems to treat “localhost” differently:
$ ansible -i inventories/inventory.ini -m synchronize -a ‘src=/Users/flionell/Downloads/ojdbc/ dest=/home/tibco/tibco_home/ojdbclib’ myvm
myvm | FAILED! => {
“changed”: false,
“cmd”: “/usr/bin/rsync --delay-updates -F --compress --archive --rsh ‘ssh -S none -o StrictHostKeyChecking=no -o Port=15022’ --out-format=‘<>%i %n%L’ "/Users/flionell/Downloads/ojdbc/" "/home/tibco/tibco_home/ojdbclib"”,
“failed”: true,
“msg”: “rsync: mkdir "/home/tibco/tibco_home/ojdbclib" failed: No such file or directory (2)\nrsync error: error in file IO (code 11) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/main.c(544) [receiver=2.6.9]\nrsync: connection unexpectedly closed (8 bytes received so far) [sender]\nrsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]\n”,
“rc”: 12
}
It seems synchronize
is trying to sync localhost to itself, not using my ansible_host
or ansible_user
variables. See the parameters to rsync, the target doesn’t contain “user@host:” prefixes.
If I use a host different from localhost / 127.0.0.1, it sends correct parameters to rsync with user@host:…
unexisting_host ansible_host=some_host_name ansible_user=someuser
ansible -i inventories/inventory.ini -m synchronize -a ‘src=/Users/flionell/Downloads/ojdbc/ dest=/home/tibco/tibco_home/ojdbclib’ unexisting_host
unexisting_host | FAILED! => {
“changed”: false,
“cmd”: “/usr/bin/rsync --delay-updates -F --compress --archive --rsh ‘ssh -S none -o StrictHostKeyChecking=no’ --out-format=‘<>%i %n%L’ "/Users/flionell/Downloads/ojdbc/" "someuser@some_host_name:/home/tibco/tibco_home/ojdbclib"”,
“failed”: true,
“msg”: “ssh: Could not resolve hostname some_host_name: nodename nor servname provided, or not known\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]\n”,
“rc”: 12
}
Does that rings a bell to anyone ?
Thanks,
Regards,