I am setting up my ansible playbook to configure my servers to authenticate through Windows AD rather than the local authentication system. I everything is working except when I run

net ads join -U myusername

This command requires that I type in myusername's password, which is different than the ssh and sudo passwords. Is there a way to either store a password in vault and have ansible grab it for that command? If not, is there a way to have ansible prompt me for the password rather than just crash so I can type it in manually? T


You can supply the password to net ads join like this:

net ads join -U <username>%<password>

Store the password in an ansible vault file, then use it in the Ansible task using the shell or command module as usual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.