Uploaded image for project: 'Ansible Cloud Automation'
  1. Ansible Cloud Automation
  2. ACA-1981

[community.aws/1157] community.aws.aws_ssm not exiting after running command

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      https://github.com/ansible-collections/community.aws/issues/1157

          1. Summary

      when i run command using ssm it is not exiting if commands run successfully. it is waiting for timeout.

          1. Issue Type

      Bug Report

          1. Component Name

      aws_ssm

      <127.0.0.1> EXEC stdout line: {"changed": true, "stdout": "Linux xxxx 4.12.14-122.116-default #1 SMP Tue Apr 5 13:16:39 UTC 2022 (b42b08b) x86_64 x86_64 x86_64 GNU/Linux", "stderr": "", "rc": 0, "cmd": "uname -a", "start": "2022-05-25 01:09:30.376981", "end": "2022-05-25 01:09:30.381839", "delta": "0:00:00.004858", "msg": "", "invocation": {"module_args":

      {"_raw_params": "uname -a", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}

      }}
      <127.0.0.1> EXEC remaining: 60
      <127.0.0.1> EXEC remaining: 59
      <127.0.0.1> EXEC remaining: 58
      <127.0.0.1> EXEC remaining: 57
      <127.0.0.1> EXEC remaining: 56
      <127.0.0.1> EXEC remaining: 55
      ^C<127.0.0.1> CLOSING SSM CONNECTION TO: i-xxxx

          1. Ansible Version

      ```console (paste below)
      $ ansible --version

      ```
      ansible [core 2.11.9]
      config file = /etc/ansible/ansible.cfg
      configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
      ansible collection location = /etc/ansible/collections:/root/.ansible/collections:/usr/share/ansible/collections
      executable location = /bin/ansible
      python version = 3.6.8 (default, Sep 10 2021, 09:13:53) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
      jinja version = 2.10.1
      libyaml = True

          1. Collection Versions

      ```console (paste below)
      $ ansible-galaxy collection list

      1. /etc/ansible/collections/ansible_collections
        Collection Version
                              • -------
                                amazon.aws 3.1.1
                                community.aws 3.1.0
                                steampunk.aws 0.8.4
      1. /root/.ansible/collections/ansible_collections
        Collection Version
                              • -------
                                amazon.aws 3.0.0
                                ```
          1. AWS SDK versions

      ```console (paste below)
      $ pip show boto boto3 botocore
      ```
      Name: boto3
      Version: 1.22.0
      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: /root/.local/lib/python3.6/site-packages
      Requires: s3transfer, jmespath, botocore

      Name: botocore
      Version: 1.25.0
      Summary: Low-level, data-driven core of boto 3.
      Home-page: https://github.com/boto/botocore
      Author: Amazon Web Services
      Author-email: None
      License: Apache License 2.0
      Location: /root/.local/lib/python3.6/site-packages
      Requires: python-dateutil, urllib3, jmespath

          1. Configuration

      ```console (paste below)
      $ ansible-config dump --only-changed

      ```

          1. OS / Environment

      No response

          1. Steps to Reproduce

      <!--- Paste example playbooks or commands between quotes below -->
      ```yaml (paste below)

      ```

      • name: test connection
        hosts: localhost
        tasks:
      • name: Get AWS Access
        community.aws.sts_assume_role:
        role_arn: "arn:aws:iam::xxx:role/xxx"
        role_session_name: "testrole1"
        register: assumed_role
      • name: test_file_name
        hosts: localhost
        gather_facts: false
        vars:
        ansible_aws_ssm_region: us-east-1
        ansible_aws_ssm_instance_id: "xxxxxx"
        ansible_connection: aws_ssm
        ansible_aws_ssm_bucket_name: xxxx
        ansible_aws_ssm_access_key_id: "{{ assumed_role.sts_creds.access_key }}"
        ansible_aws_ssm_secret_access_key: "{{ assumed_role.sts_creds.secret_key }}"
        ansible_aws_ssm_session_token: "{{ assumed_role.sts_creds.session_token }}"
        tasks:
      • name: Test file
        shell: uname -a
          1. Expected Results

      i expected ssm to close connection when command ran succssfully.

          1. Actual Results

      ```console (paste below)

      ```
      '
      <127.0.0.1> EXEC stdout line: oFzeglPfjxKVluuJclMsdmGbJc
      <127.0.0.1> EXEC stdout line: % Total % Received % Xferd Average Speed Time Time Time Current
      <127.0.0.1> EXEC stdout line: Dload Upload Total Spent Left Speed
      100 124k 100 124k 0 0 1372k 0 -::- -::- -::- 1372k
      <127.0.0.1> EXEC stdout line:
      <127.0.0.1> EXEC stdout line: 0
      <127.0.0.1> EXEC stdout line: UvxqHPPWcmXBfzsgGnTLlcjBvo
      <127.0.0.1> POST_PROCESS: % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      100 124k 100 124k 0 0 1372k 0 -::- -::- -::- 1372k

      0
      <127.0.0.1> (0, ' % Total % Received % Xferd Average Speed Time Time Time Current\r\r\n Dload Upload Total Spent Left Speed\r\r\n\r 0 0 0 0 0 0 0 0 -::- -::- -::- 0\r100 124k 100 124k 0 0 1372k 0 -::- -::- -::- 1372k\r\r', '')
      <127.0.0.1> (0, ' % Total % Received % Xferd Average Speed Time Time Time Current\r\r\n Dload Upload Total Spent Left Speed\r\r\n\r 0 0 0 0 0 0 0 0 -::- -::- -::- 0\r100 124k 100 124k 0 0 1372k 0 -::- -::- -::- 1372k\r\r', '')
      <127.0.0.1> EXEC chmod u+x /tmp//ansible/ansible-tmp-1653455368.1676185-211188-85325719141651/ /tmp//ansible/ansible-tmp-1653455368.1676185-211188-85325719141651/AnsiballZ_command.py
      <127.0.0.1> _wrap_command: 'echo ndpgTebtZwFcXcwClvNKkeJynb
      chmod u+x /tmp//ansible/ansible-tmp-1653455368.1676185-211188-85325719141651/ /tmp//ansible/ansible-tmp-1653455368.1676185-211188-85325719141651/AnsiballZ_command.py
      echo $'\n'$?
      echo zecjVeelXUiOEoBHdOlruYQarr
      '
      <127.0.0.1> EXEC stdout line: ndpgTebtZwFcXcwClvNKkeJynb
      <127.0.0.1> EXEC stdout line:
      <127.0.0.1> EXEC stdout line: 0
      <127.0.0.1> EXEC stdout line: zecjVeelXUiOEoBHdOlruYQarr
      <127.0.0.1> POST_PROCESS:
      0
      <127.0.0.1> (0, '\r', '')
      <127.0.0.1> EXEC /usr/bin/python3.6 /tmp//ansible/ansible-tmp-1653455368.1676185-211188-85325719141651/AnsiballZ_command.py
      <127.0.0.1> _wrap_command: 'echo uYQrEQDkifUMFwlFBTGbhhbbTo
      sudo /usr/bin/python3.6 /tmp//ansible/ansible-tmp-1653455368.1676185-211188-85325719141651/AnsiballZ_command.py
      echo $'\n'$?
      echo GZSTOeaPGDIFXMHUVRpKWIGehb
      '
      <127.0.0.1> EXEC stdout line: uYQrEQDkifUMFwlFBTGbhhbbTo
      <127.0.0.1> EXEC stdout line:
      <127.0.0.1> EXEC stdout line: {"changed": true, "stdout": "Linux xxxx 4.12.14-122.116-default #1 SMP Tue Apr 5 13:16:39 UTC 2022 (b42b08b) x86_64 x86_64 x86_64 GNU/Linux", "stderr": "", "rc": 0, "cmd": "uname -a", "start": "2022-05-25 01:09:30.376981", "end": "2022-05-25 01:09:30.381839", "delta": "0:00:00.004858", "msg": "", "invocation": {"module_args":

      {"_raw_params": "uname -a", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}

      }}
      <127.0.0.1> EXEC remaining: 60
      <127.0.0.1> EXEC remaining: 59
      <127.0.0.1> EXEC remaining: 58
      <127.0.0.1> EXEC remaining: 57
      <127.0.0.1> EXEC remaining: 56
      <127.0.0.1> EXEC remaining: 55
      ^C<127.0.0.1> CLOSING SSM CONNECTION TO: i-xxx

          1. Code of Conduct
      • [X] I agree to follow the Ansible Code of Conduct

              Unassigned Unassigned
              jrouleau Jill Rouleau
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: