Ansible windows patch trouble: Need help for Win Patch Automation using Ansible

Looks like your playbook is running against localhost only.so when it gets to the Windows portion it’s trying to run powershell on the Linux host,hence the powershell error.
You need to either delegate_to the Windows host group or use the Windows host group as a separate hosts block wrapping the operations the Windows host needs to do.
Inventory file looks fine.