community.aws icon indicating copy to clipboard operation
community.aws copied to clipboard

aws_ssm connection plugin not work on MacOS on Python 3

Open piotrplenik opened this issue 3 years ago • 3 comments

SUMMARY

When try to do win_ping task, task stuck

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.aws - 1.2.1

ANSIBLE VERSION
ansible 2.10.3
  config file = /Users/plpi8001/workspace/ansible-hosts-maintanance/ansible.cfg
  configured module search path = ['/Users/plpi8001/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]

CONFIGURATION
COLLECTIONS_PATHS(/Users/plpi8001/workspace/ansible-hosts-maintanance/ansible.cfg) = ['/Users/plpi8001/workspace/ansible-hosts-maintanance/collections']
GALAXY_SERVER_LIST(/Users/plpi8001/workspace/ansible-hosts-maintanance/ansible.cfg) = ['release_galaxy']
INVENTORY_ENABLED(/Users/plpi8001/workspace/ansible-hosts-maintanance/ansible.cfg) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml']

OS / ENVIRONMENT

ProductName: Mac OS X ProductVersion: 10.15.7 BuildVersion: 19H15

STEPS TO REPRODUCE

Command:

ansible -m win_ping -i inventories/nonprod.testing.aws_ec2.yml aws_ec2_platform_windows -vvvv

EXPECTED RESULTS

OK

ACTUAL RESULTS
ansible 2.10.3
  config file = /Users/plpi8001/workspace/ansible-hosts-maintanance/ansible.cfg
  configured module search path = ['/Users/plpi8001/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]
Using /Users/plpi8001/workspace/ansible-hosts-maintanance/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /Users/plpi8001/workspace/ansible-hosts-maintanance/inventories/nonprod.testing.aws_ec2.yml as it did not pass its verify_file() method
script declined parsing /Users/plpi8001/workspace/ansible-hosts-maintanance/inventories/nonprod.testing.aws_ec2.yml as it did not pass its verify_file() method
redirecting (type: inventory) ansible.builtin.aws_ec2 to amazon.aws.aws_ec2
Loading collection amazon.aws from /Users/plpi8001/workspace/ansible-hosts-maintanance/collections/ansible_collections/amazon/aws
Parsed /Users/plpi8001/workspace/ansible-hosts-maintanance/inventories/nonprod.testing.aws_ec2.yml inventory source with auto plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/lib/python3.8/site-packages/ansible/plugins/callback/minimal.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
Loading collection community.aws from /Users/plpi8001/workspace/ansible-hosts-maintanance/collections/ansible_collections/community/aws
<i-014972904584f6175> ESTABLISH SSM CONNECTION TO: i-014972904584f6175
<i-014972904584f6175> SSM COMMAND: ['/usr/local/bin/session-manager-plugin', '{"SessionId": "CORRECT_SESSION", "TokenValue": "CORRECT_VALUE", "StreamUrl": "wss://ssmmessages.eu-west-1.amazonaws.com/v1/data-channel/CORRECT_SESSION?role=publish_subscribe", "ResponseMetadata": {"RequestId": "5e3162cd-006b-4ae6-b4c6-85fe6af9e595", "HTTPStatusCode": 200, "HTTPHeaders": {"server": "Server", "date": "Thu, 03 Dec 2020 13:13:25 GMT", "content-type": "application/x-amz-json-1.1", "content-length": "676", "connection": "keep-alive", "x-amzn-requestid": "5e3162cd-006b-4ae6-b4c6-85fe6af9e595"}, "RetryAttempts": 0}}', 'eu-west-1', 'StartSession', '', '{"Target": "i-014972904584f6175"}', 'https://ssm.eu-west-1.amazonaws.com']
<i-014972904584f6175> SSM CONNECTION ID: CORRECT_SESSION
<i-014972904584f6175> EXEC PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand CORRECT_COMMAND_BASE
<i-014972904584f6175> _wrap_command: 'PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand CORRECT_COMMAND_BASE; echo sNxsYqHfBOVsovdqBnyvCgJswH $LASTEXITCODE
echo hUfTfmHBbHAsnmGoVNtbzKzICK
'
<i-014972904584f6175> EXEC stdout line: 
<i-014972904584f6175> EXEC stdout line: Starting session with SessionId: CORRECT_SESSION
<i-014972904584f6175> EXEC remaining: 60
<i-014972904584f6175> EXEC stdout line: Windows PowerShell
<i-014972904584f6175> EXEC stdout line: Copyright (C) 2016 Microsoft Corporation. All rights reserved.
<i-014972904584f6175> EXEC stdout line: 
PS C:\Windows\system32> PowerShell -NoProfile -NonInteractive -ExecutionPol
<i-014972904584f6175> EXEC stdout line: >> echo hUfTfmHBbHAsnmGoVNtbzKzICK
<i-014972904584f6175> EXEC stdout line: >> PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgAkAHQAbQBwAF8AcABhAHQAaAAgAD0AI
<i-014972904584f6175> EXEC stdout line: ABbAFMAeQBzAHQAZQBtAC4ARQBuAHYAaQByAG8AbgBtAGUAbgB0AF0AOgA6AEUAeABwAGEAbgBkAEUAbgB2AGkAcgBvAG4AbQBlAG4AdABWAGEAcgBpAGEAYgBsAGUAcwAoACcAJQBUAEUATQBQACUAJwApAAoAJAB0AG0AcAAgAD0AIABOAGUAdwAtAEkAdABlAG0AI
<i-014972904584f6175> EXEC stdout line: AAtAFQAeQBwAGUAIABEAGkAcgBlAGMAdABvAHIAeQAgAC0AUABhAHQAaAAgACQAdABtAHAAXwBwAGEAdABoACAALQBOAGEAbQBlACAAJwBhAG4AcwBpAGIAbABlAC0AdABtAHAALQAxADYAMAA3ADAAMAAxADIAMAA0AC4AOAA4ADIAOQAyADkAOAAtADkAMAA2ADQAM
<i-014972904584f6175> EXEC stdout line: gAtADIANwA1ADUANAA2ADkANgA1ADEANwA1ADUANwA0ACcACgBXAHIAaQB0AGUALQBPAHUAdABwAHUAdAAgAC0ASQBuAHAAdQB0AE8AYgBqAGUAYwB0ACAAJAB0AG0AcAAuAEYAdQBsAGwATgBhAG0AZQAKAEkAZgAgACgALQBuAG8AdAAgACQAPwApACAAewAgAEkAZ
<i-014972904584f6175> EXEC stdout line: gAgACgARwBlAHQALQBWAGEAcgBpAGEAYgBsAGUAIABMAEEAUwBUAEUAWABJAFQAQwBPAEQARQAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQApACAAewAgAGUAeABpAHQAIAAkAEwAQQBTAFQARQBYAEkAV

piotrplenik avatar Dec 03 '20 13:12 piotrplenik

Files identified in the description: None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Jan 13 '21 00:01 ansibullbot

I had a possibly similar issue connecting to a client RHEL 8 running Python 3.6 - it would be able to receive the script, generate the "pong" response, but it would be stuck on the return (timeout, retry, timeout...).

My local MacOS python is 2.7.

If the client runs 2.7, things seem to work fine.

Relevant logs:

...
<i-06fd485XXX> EXEC /usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1613486535.048039-72908-99453129968755/AnsiballZ_ping.py
<i-06fd485XXX> _wrap_command: 'echo rUomONzUiEozxZLQAEasVcpqoU
sudo /usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1613486535.048039-72908-99453129968755/AnsiballZ_ping.py
echo $'\n'$?
echo vMkdDZFYkzujImzOMfMZvGGxGC
'
<i-06fd485XXX> EXEC stdout line: rUomONzUiEozxZLQAEasVcpqoU
<i-06fd485XXX> EXEC stdout line: 
<i-06fd485XXX> EXEC stdout line: {"ping": "pong", "invocation": {"module_args": {"data": "pong"}}}
<i-06fd485XXX> EXEC remaining: 59
<i-06fd485XXX> EXEC remaining: 58
...

hexsel avatar Feb 16 '21 15:02 hexsel

Nops, my bad, this was actually caused by a sudo bug. Apologies.

This is the bug, for future reference: https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/1895757 (it's sudo-specific, not Ubuntu-specific)

hexsel avatar Feb 16 '21 17:02 hexsel

Thanks for taking the time to open this issue. I'm sorry it's taken so long to get back to you.

With release 5.2.0 we've fixed a number of issues reported connecting to Windows servers, which I suspect has fixed this issue, and as such will close this issue. If you're able to reproduce this issue with release 5.2.0 please let us know.

tremble avatar Jan 25 '23 15:01 tremble