Ansible Playbook Error: The powershell shell family is incompatible with the sudo become plugin

Question:

I am working on a simple playbook that will ultimately be able to start/stop/restart windows services and I ran into an issue:

Below is the playbook:

Google hasn’t been much help, and I’ve tried everything I could find, every variation of become*.

I don’t know if it matters, but due to the nature of the environment I work in, I have 2 separate users to log into *nix hosts vs. windows hosts.

Any assistance or guideance would be greatly appreciated.

Answer:

Your system seems to use sudo as the default become method, which is not compatible with PowerShell. For Windows (and PowerShell), you can use runas as the become method. Add:

to your playbook or task. You can get a list of all available become methods with:

Example:

You can view the documentation for a particular become method with:


If you still get erros, pay attention to the error message, as it most probably is a different one. Using privilege escalation requires the definition of a username and a password for this purpose, for example.

Source:

Ansible Playbook Error: The powershell shell family is incompatible with the sudo become plugin by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply