We want to use ansible to connect to a managed device. We have created a host_var file with the username and the password. Here is the host_var/mydevice file:
---
username: myuser
password: secret#secret
We used below ansible command to connect to mydevice:
ansible mydevice -vvvv -u myuser -m raw -a "ping 1.2.3.4"
However, we are getting the authentication error like below:
mydevice | UNREACHABLE! => {
"changed": false,
"msg": "Failed to authenticate: Authentication failed.",
"unreachable": true
}
When we connect to mydevice using ssh connection, we type in the password and the device accepts it without problem. We are able to connect.
When add -k switch to ansible command, type in the password, getting the same authentication failure.
Also tried using back slash symbol '\' and double back slash symbol '\\' before '#' symbol. Does NOT work either.
Is it because the '#' symbol issue? How do we escape it?
Thank you,
- Xinhuan