Interview Prep/Ansible/Cloud, AWX, Windows and Molecule

`The powershell shell family is incompatible with the sudo become plugin`

IntermediateTroubleshootingCloud, AWX, Windows and Molecule
Answer

Likely causes → become: true with the default sudo method was inherited by Windows hosts, usually from group_vars/all or play-level settings shared with Linux.

Fix →

# group_vars/windows.yml
ansible_connection: winrm
ansible_shell_type: powershell
ansible_become_method: runas
ansible_become_user: SYSTEM      # only where elevation is really needed

Better, do not set become for Windows plays at all unless a task needs it.

Prevent → Keep separate plays and group variables for Linux and Windows, and do not put connection or become settings in all.

All Ansible questions Roadmap: Ansible

More on Cloud, AWX, Windows and Molecule