When ran ping from root user prompt by mentioning "delpoy" user , it errors out.
[root@dev-armor21 ~]# ansible all -m ping --user=delpoy
dev-mado21 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
}
dev-pipe21 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
}
dev-mado22 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
}
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
++++++++++++++++++++++++++++++++++
But when switch to deploy user and run ansible ping , it works fine
++++++++++++++++++++++++++++++++++
[root@dev-armor21 ~]# su - deploy
[deploy@dev-armor21 ~]$ ansible all -m ping
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
dev-mado22 | SUCCESS => {
"changed": false,
"ping": "pong"
}
dev-pipe21 | SUCCESS => {
"changed": false,
"ping": "pong"
}
dev-mado21 | SUCCESS => {
"changed": false,
"ping": "pong"
}
[deploy@dev-armor21 ~]$
My objective is to run ansible command from root ( do not want to share root keys to all hosts ) and with specific users .
Prakash.