I have a playbook with different plays. Some plays are run with a specific user, for which we cannot set keys, and also does sudo to another user. The other plays, use a regular user, for which there are ssh keys.
My issue is that for the firs play, I need to run "ansible-playbook -Kk", but I want the rest of the plays to be ran with ssh key. It fails because it tries to use the password given early...
Is there a way to make specific plays to prompt for password, like -kK would do?
However it’s the very very first time I was asked this, so I imagine some other people may have suggestions and I’d want to explore before we got into making features or syntax suggestions out of it.
Running it in two seperate plays is one somewhat clear solution.
I have this issue when I provision a node for the first time. By default, the nodes come up with password required for sudo and without ssh keys.
I have a role called “nopasswd” that copies a public key into an account with sudo privileges and adds a file to /etc/sudoers.d that allows passwordless sudo for that account.
I do what Michael mentioned, I run a playbook with -kK args with the nopasswd role, and after that I just run my other playbooks with -kK.