Im trying to copy a file with the following command line with ansible, but getting error with creds.
ansible -i ./hosts all -m copy -a "src=/etc/hosts dest=/tmp/hosts" -k
SSH password:
192.168.0.166 | UNREACHABLE! => { "changed": false, "msg": "Invalid/incorrect password: Permission denied, please try again.", "unreachable": true
However I get the correct output when run a ping.
ansible -i ./hosts all -u ansible -m ping
192.168.0.122 | SUCCESS => { "changed": false, "ping": "pong"
The ssh public key is copied into the server for sure. The permission in the linux folder as far as i checked are ok. I need to run this with this line, not using playbook. Do you have any idea ? Do i need to specify a user?