AnsiblePilot — Master Ansible Automation
AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.
Popular Topics
About Luca Berton
Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.
Ansible PowerShell & sudo Become Error: 'powershell is not compatible' Fix — Video Tutorial
Fix the Ansible error 'powershell is not compatible with the sudo become plugin'. Occurs when targeting Windows hosts with Linux-style privilege escalation.
What You'll Learn
- Introduction
- The Demo
- Error Code
- Error Execution
- Fix Code
- Fix Execution
- Conclusion
- Why This Error Happens
- Fix Options
- Fix 1: Use `runas` become method for Windows
Full Tutorial Content
Introduction
Welcome back to Ansible Pilot! I'm Luca Berton, and today we're diving into Ansible troubleshooting, focusing on the error that states "the PowerShell shell family is incompatible with the sudo become plugin." Join me as we explore how to reproduce, troubleshoot, and fix this runtime error in Ansible.
The Demo
To better understand and solve the "the PowerShell shell family is incompatible with the sudo become plugin" error, let's jump into a live Playbook.
Error Code
```yaml
incompatiblesudo_error.yml
---
- name: win_reboot module Playbook
hosts: all
become: true
tasks:
- name: reboot host(s)
ansible.windows.win_reboot:
```
Error Execution
```bash
$ ansible-playbook -i win/inventory troubleshooting/incompatiblesudo_error.yml
PLAY [win_reboot module Playbook] *********************************************************************
TASK [Gathering Facts] ****************************************************************************
fatal: [WindowsServer]: FAILED! => {"msg": "The PowerShell shell family is incompatible with the sudo become plugin"}
PLAY RECAP ****************************************************************************************
WindowsServer : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
```
Fix Code
```yaml
incompatiblesudo_fix.yml
---
- name: win_reboot module Playbook
hosts: all
become: false
tasks:
- name: reboot host(s)
ansible.windows.win_reboot:
```
Fix Execution
```bash
$ ansible-playbook -i win/inventory troubleshooting/incompatiblesudo_fix.yml
PLAY [win_reboot module Playbook] *********************************************************************
TASK [Gathering Facts] ****************************************************************************
ok: [WindowsServer]
TASK [reboot host(s)] *****************************************************************************
changed: [WindowsServer]
PLAY RECAP ****************************************************************************************
WindowsServer : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
```
Conclusion
In this troubleshooting guide, we successfully tackled the "PowerShell incompatible with the sudo become plugin" error in Ansible. By adjusting the playbook to disable the become plugin, we overcame the compatibility issue.
I hope this Playbooknstration helps you effectively troubleshoot and resolve similar errors in your Ansible automation journey. If you found this information valuable, don't forget to subscribe for more Ansible insights.
Why This Error Happens
This error occurs when Ansible tries to use the **Linux `sudo` become plugin** with a **Windows target** running PowerShell. Windows doesn't have `sudo` — it uses different privilege escalation methods.
The typical error message:
```
fatal: [windows_host]: FAILED! => {"msg": "The powershell shell family is incompatible with the sudo become
About This Tutorial
- Author: Luca Berton
- Difficulty: Beginner
- Read time: 4 min
- Category: installation
Read the full written article: Ansible PowerShell & sudo Become Error: 'powershell is not compatible' Fix