diff --git a/changelogs/fragments/542-ensure-ssm-plugin-terminates-connections.yml b/changelogs/fragments/542-ensure-ssm-plugin-terminates-connections.yml new file mode 100644 index 00000000000..1cbe860d1d2 --- /dev/null +++ b/changelogs/fragments/542-ensure-ssm-plugin-terminates-connections.yml @@ -0,0 +1,2 @@ +bugfixes: + - aws_ssm - Adds destructor to SSM connection plugin to ensure connections are properly cleaned up after usage (https://github.com/ansible-collections/community.aws/pull/542). diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index b013ff5a71a..23e222614d0 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -280,6 +280,9 @@ def __init__(self, *args, **kwargs): self._shell_type = 'powershell' self.is_windows = True + def __del__(self): + self.close() + def _connect(self): ''' connect to the host via ssm '''