Ansible static inventory with dynamic tags for Amazon EC2 Windows instances

Hi All,

I am working on a project where in agents needs to be installed on running windows instances on AWS account. I need to discover the instances based on tags (ex - tag_owner_poornima) but I am facing issues. Below are the configurations that I have made.

hosts :

[win]
tag_owner_poornima

[win:vars]
ansible_connection=winrm
ansible_ssh_port=5986
ansible_ssh_user=Administrator
ansible_ssh_pass=myTempPassword123!
ansible_winrm_transport=ntlm
ansible_winrm_server_cert_validation=ignore

Under group_vars/win.yml :

ansible_user: Administrator
ansible_password: myTempPassword123!
anisble_port: 5986
ansibe_connection: winrm
ansible_winrm_transport: ntlm
ansible_winrm_server_cert_validation: ignore

When I run the command- “ansible win -m win_ping”, I facing the following issue.

tag_owner_poornima | UNREACHABLE! => {
“changed”: false,
“msg”: “ntlm: HTTPSConnectionPool(host=‘tag_owner_poornima’, port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError(‘<urllib3.connection.VerifiedHTTPSConnection object at 0x22fc0d0>: Failed to establish a new connection: [Errno -2] Name or service not known’,))”,
“unreachable”: true
}

Could somebody please help me on this.

Thanks in advance.