Troubleshooting Ansible: Resolving the "PowerShell Incompatible with the Sudo Become Plugin" Error
How to reproduce, troubleshoot, and fix "the PowerShell shell family is incompatible with the sudo become plugin" Ansible runtime error.
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 demo.
Error Code
# incompatiblesudo_error.yml
---
- name: win_reboot module demo
hosts: all
become: true
tasks:
- name: reboot host(s)
ansible.windows.win_reboot:
Error Execution
$ ansible-playbook -i win/inventory troubleshooting/incompatiblesudo_error.yml
PLAY [win_reboot module demo] *********************************************************************
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
The Best Resources For Ansible
Certifications
- Coursera Pro - Unlimited access to 7,000+ world-class courses, hands-on projects, and job-ready certificate programs—all included in your subscription
Video Course
Printed Book
-
Ansible For VMware by Examples
-
Ansible for Kubernetes by Example
-
Hands-on Ansible Automation
-
Red Hat Ansible Automation Platform
eBooks
- Ansible by Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
- Ansible Cookbook: A Comprehensive Guide to Unleashing the Power of Ansible via Best Practices, Troubleshooting, and Linting Rules with Luca Berton
- Terraform By Example: A Practical Approach for Beginners to Learn Cloud Infrastructure with Terraform
- Ansible For Windows By Examples: 50+ Automation Examples For Windows System Administrator And DevOps
- Ansible For Linux by Examples: 100+ Automation Examples For Linux System Administrator and DevOps
- Ansible Linux Filesystem By Examples: 40+ Automation Examples on Linux File and Directory Operation for Modern IT Infrastructure
- Ansible For Security by Examples: 100+ Automation Examples to Automate Security and Verify Compliance for IT Modern Infrastructure
- Ansible Tips and Tricks: 10+ Ansible Examples to Save Time and Automate More Tasks
- Ansible Linux Users & Groups By Examples: 20+ Automation Examples on Linux Users and Groups Operation for Modern IT Infrastructure
- Ansible For PostgreSQL by Examples: 10+ Examples To Automate Your PostgreSQL database
- Ansible For Amazon Web Services AWS By Examples: 10+ Examples To Automate Your AWS Modern Infrastructure
- Ansible Automation Platform By Example: A step-by-step guide for the most common user scenarios
Fix Code
# incompatiblesudo_fix.yml
---
- name: win_reboot module demo
hosts: all
become: false
tasks:
- name: reboot host(s)
ansible.windows.win_reboot:
Fix Execution
$ ansible-playbook -i win/inventory troubleshooting/incompatiblesudo_fix.yml
PLAY [win_reboot module demo] *********************************************************************
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
Recap
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 demonstration 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.
Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.Academy
Learn the Ansible automation technology with some real-life examples in my
My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
Donate
Want to keep this project going? Please donate