Hii,
I would like to have a playbook trigger the asking of the become password, but I couldn’t find how to do it.
Is there perhaps some variable that can be set in a playbook (or play) to do this? I was thinking of something like “ask_become_pass: true” or something like that.
Better to use ssh keys or store the details in ansible vault or something but if you need to prompt for the password you could potentially use vars_prompt: ?
Because I don’t want to have to remember to use it.
I have several playbooks, some of them require -K and some of them do not.
I think it should be possible to express that requirement with some parameter, so that I don’t have to remember it.
Is the above workaround less secure than doing -K on the command line?
Potentially, as far as I can tell the workaround does nothing to stop a plaintext log of the password in memory. You might also consider using ansible Vault, and the ansible_become_password variable. This seems more inline with what you need/want. Even allows for using different passwords in various points by changing the variable with set.