Ansible Playbook is failing to read a config file on windows


I have ansible playbook which I am executing it via AWX.This playbook tries to read file on windows machine.I have created a credential in AWX where I provided username and password.I did’nt provided any Privilege Escalation Method.

I am importing this playbook in another playbook:-
- name: include detail agent playbook - Windows
import_playbook: detail_agent_telegraf_win.yml
- (action == ‘log’ or action == ‘list’ or action == ‘view’ or action == ‘view_tgf_conf’) and (deployed_by != ‘Cloud-Autodeployment’)
- hostvars[server][“platform_os”] == ‘Windows’

This is the playbook:-

- name: Play to perform read operations on different telegraf files
  hosts: "{{ server }}"

    - name: View Agent Conf File On Windows
      win_command: type C:\InfluxData\Telegraf\telegraf.conf
        - action == 'view_tgf_conf'

I am getting this error from the playbook
{“msg”: “The powershell shell family is incompatible with the sudo become plugin”}

But Privilege Escalation is enabled on the job template level

This are the host_vars for the windows host:-

ansible_user: sec_cred
ansible_connection: winrm
ansible_winrm_transport: basic
ansible_port: '5986'
ansible_winrm_server_cert_validation: ignore

Can you plz provide me the solution.I am new to ansible.Appreciate the help

Hi, could you please try specifying runas as Privilege Escalation Method on machine credentials for Windows-based hosts, or addding ansible_become_method: runas as host variables.