encountering a connection timeout error when attempting to connect to a Windows 10 Enterprise instance using the Ansible aws_ssm connection to connected with instance. The connection initiates, but commands executed in the PowerShell session are not recognized, leading to a timeout. below are the details and error logs for reference.
"msg": "timed out waiting for ping module test: SSM start_session timeout on host
i-Instance-id> EXEC stdout line: Starting session with SessionId: user@domain.com-rvollhksqb2vjgyiaxyntlvrry
EXEC remaining: 300
EXEC remaining: 299
EXEC stdout line: Windows PowerShell
EXEC stdout line: Copyright (C) Microsoft Corporation. All rights reserved.
EXEC stdout line:
EXEC stdout line: Try the new cross-platform PowerShell
https://aka.ms/pscore6
EXEC stdout line:
PS C:\Windows\system32> stty -echo
EXEC stdout line: stty : The term 'stty' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
EXEC stdout line: correct and try again.
EXEC stdout line: At line:1 char:1
EXEC stdout line: + stty -echo
EXEC stdout line: + ~~~~
EXEC stdout line: + CategoryInfo : ObjectNotFound: (stty:String) [], CommandNotFoundException
EXEC stdout line: + FullyQualifiedErrorId : CommandNotFoundException
EXEC stdout line:
PS C:\Windows\system32> PS1=''
EXEC stdout line: PS1= : The term 'PS1=' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
EXEC stdout line: correct and try again.
EXEC stdout line: At line:1 char:1
EXEC stdout line: + PS1=''
EXEC stdout line: + ~~~~~~
EXEC stdout line: + CategoryInfo : ObjectNotFound: (PS1=:String) [], CommandNotFoundException
EXEC stdout line: + FullyQualifiedErrorId : CommandNotFoundException
EXEC stdout line:
EXEC stdout line: PS C:\Windows\system32> echo eTkiUoOWuOHufaIdTMsxFQmkbF
EXEC stdout line: eTkiUoOWuOHufaIdTMsxFQmkbF
EXEC stdout line: PS C:\Windows\system32> echo ~root
EXEC stdout line: ~root
EXEC stdout line: PS C:\Windows\system32> echo $'\n'$?
EXEC stdout line: $\nTrue
EXEC stdout line: PS C:\Windows\system32> echo IvmnbxBFbvqACddGjZUpUONOUD
POST_PROCESS: PS C:\Windows\system32> echo ~root
~root
PS C:\Windows\system32> echo $'\n'$?
$\nTrue
ssm_retry: attempt: 0, caught exception(invalid literal for int() with base 10: '$\\nTrue\x1b[0K') from cmd (echo ~root...), pausing for 0 seconds
CLOSING SSM CONNECTION TO: i-Instance-id
### Issue Type
Bug Report
### Component Name
ec2_instance, ssm , win10
### Ansible Version
ansible [core 2.11.12]
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /bin/ansible
python version = 2.7.18 (default, Dec 18 2023, 22:08:43) [GCC 7.3.1 20180712 (Red Hat 7.3.1-17)]
jinja version = 2.7.2
libyaml = True
### Collection Versions
Collection Version
----------------------------- -------
amazon.aws 1.5.1
ansible.netcommon 2.5.0
ansible.posix 1.3.0
ansible.utils 2.4.3
ansible.windows 1.8.0
arista.eos 2.2.0
awx.awx 19.4.0
azure.azcollection 1.10.0
check_point.mgmt 2.2.0
chocolatey.chocolatey 1.1.0
cisco.aci 2.1.0
cisco.asa 2.1.0
cisco.intersight 1.0.18
cisco.ios 2.6.0
cisco.iosxr 2.6.0
cisco.meraki 2.5.0
cisco.mso 1.2.0
cisco.nso 1.0.3
cisco.nxos 2.8.2
cisco.ucs 1.6.0
cloudscale_ch.cloud 2.2.0
community.aws 1.5.0
community.azure 1.1.0
community.crypto 1.9.8
community.digitalocean 1.13.0
community.docker 1.10.2
community.fortios 1.0.0
community.general 3.8.3
community.google 1.0.0
community.grafana 1.3.0
community.hashi_vault 1.5.0
community.hrobot 1.2.1
community.kubernetes 1.2.1
community.kubevirt 1.0.0
community.libvirt 1.0.2
community.mongodb 1.3.2
community.mysql 2.3.2
community.network 3.0.0
community.okd 1.1.2
community.postgresql 1.6.0
community.proxysql 1.3.0
community.rabbitmq 1.1.0
community.routeros 1.2.0
community.skydive 1.0.0
community.sops 1.2.0
community.vmware 1.17.0
community.windows 1.8.0
community.zabbix 1.5.1
containers.podman 1.9.0
cyberark.conjur 1.1.0
cyberark.pas 1.0.13
dellemc.enterprise_sonic 1.1.0
dellemc.openmanage 3.6.0
dellemc.os10 1.1.1
dellemc.os6 1.0.7
dellemc.os9 1.0.4
f5networks.f5_modules 1.13.0
fortinet.fortimanager 2.1.4
fortinet.fortios 2.1.3
frr.frr 1.0.3
gluster.gluster 1.0.2
google.cloud 1.0.2
hetzner.hcloud 1.6.0
hpe.nimble 1.1.4
ibm.qradar 1.0.3
infinidat.infinibox 1.3.0
inspur.sm 1.3.0
junipernetworks.junos 2.8.0
kubernetes.core 1.2.1
mellanox.onyx 1.0.0
netapp.aws 21.7.0
netapp.azure 21.10.0
netapp.cloudmanager 21.12.1
netapp.elementsw 21.7.0
netapp.ontap 21.14.1
netapp.um_info 21.8.0
netapp_eseries.santricity 1.2.13
netbox.netbox 3.4.0
ngine_io.cloudstack 2.2.2
ngine_io.exoscale 1.0.0
ngine_io.vultr 1.1.0
openstack.cloud 1.5.3
openvswitch.openvswitch 2.1.0
ovirt.ovirt 1.6.6
purestorage.flasharray 1.11.0
purestorage.flashblade 1.8.1
sensu.sensu_go 1.12.0
servicenow.servicenow 1.0.6
splunk.es 1.0.2
t_systems_mms.icinga_director 1.26.0
theforeman.foreman 2.2.0
vyos.vyos 2.6.0
wti.remote 1.0.3
### AWS SDK versions
Name: boto3
Version: 1.17.112
Summary: The AWS SDK for Python
Home-page:
https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /usr/lib/python2.7/site-packages
Requires: jmespath, s3transfer, botocore
Required-by:
---
Name: botocore
Version: 1.18.6
Summary: Low-level, data-driven core of boto 3.
Home-page:
https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /usr/lib/python2.7/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: s3transfer, boto3, awscli
### Configuration
```console (paste below)
$ ansible-config dump --only-changed
```
### OS / Environment
_No response_
### Steps to Reproduce
inventory.aws_ec2.yml
---
plugin: aws_ec2
#strict: True
allow_duplicated_hosts: True
regions:
- us-east-1
filters:
tag:environment: dev
tag:purpose: custom-ec2
compose:
ansible_host: instance_id
ansible_connection: "'community.aws.aws_ssm'"
ansible_aws_ssm_timeout: "'600'"
ansible_shell_type: "'powershell' if platform_details == 'Windows' else 'sh'"
ansible_aws_ssm_bucket_name: "'bucket_name'"
Setup Ansible to connect to a Windows 10 Enterprise instance using the AWS SSM connection plugin.
Execute a playbook to start an SSM session with the target instance
playbook.yaml
---
- hosts: all
gather_facts: false
tasks:
- wait_for_connection:
- name: create test folder
win_file:
path: C:\Test
state: directory
### Expected Results
When using Ansible with the AWS SSM connection plugin to connect to a Windows 10 Enterprise instance, the session should initiate correctly, and commands should be executed without errors or timeouts
### Actual Results
_No response_
### Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct
Summary
encountering a connection timeout error when attempting to connect to a Windows 10 Enterprise instance using the Ansible aws_ssm connection to connected with instance. The connection initiates, but commands executed in the PowerShell session are not recognized, leading to a timeout. below are the details and error logs for reference.
"msg": "timed out waiting for ping module test: SSM start_session timeout on host
i-Instance-id> EXEC stdout line: Starting session with SessionId: user@domain.com-rvollhksqb2vjgyiaxyntlvrry