Hey,
I have a dynamic inventory script. The script sets these variables…
`
“Server01”{
“ansible_host”: “xxx.xxx.xxx.xxx”,
“ansible_ssh_host”: “xxx.xxx.xxx.xxx”,
“ansible_ssh_pass”: “xxxxxxxxxxxx”,
}
`
That way when you spin up a new cloud host you can immediately call a role or playbook on it. I have set up a role using the user module and have used it to set up a new ansible user and ssh key and tested it by sshing from the cmd line to the machine. The problem I have is that I changed the root password on that box and now all ansible task’s fail because it’s defaulting to the ansible_ssh_pass.
`
ansible Test -m ping
Server01 | UNREACHABLE! => {
“changed”: false,
“msg”: “ERROR! Authentication failure.”,
“unreachable”: true
}
`
Do I have something I can change in mmy playbook or cmd line to make it try ssh via key and not password?
Thanks,
Levi