Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #1176/1be7da11 backport][stable-3] ssm connection: pull bucket region info rather than taking from region var #1290

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Jun 30, 2022

This is a backport of PR #1176 as merged into main (1be7da1).

SUMMARY

Fix issue where syntax error is reported if using ssm connection and the target node is located in a different region to the s3 bucket.

Fixes #1190, #637

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

aws_ssm connection plugin

ADDITIONAL INFORMATION

When using SSM for ansible connection and the target node is in a different region to the s3 bucket used, the playbook immediately errors with the following. (There are no issues when both target and s3 bucket are in the same region)

fatal: [i-04444a7f03cc2bffd]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"failed": true, "module_stderr": "", "module_stdout": " File \"/tmp/ansible/ansible-tmp-1653576081.8378458-29658-258097978113216/AnsiballZ_setup.py\", line 1\r\r\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\r\n ^\r\r\nSyntaxError: invalid syntax\r\r", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}

The tmp file has the following contents

<?xml version="1.0" encoding="UTF-8"?> <Error><Code>AuthorizationQueryParametersError</Code><Message>Error parsing the X-Amz-Credential parameter; the region 'us-east-1' is wrong; expecting 'eu-west-1'</Message><Region>eu-west-1</Region><RequestId>4VTAGR4C1V9ATBJT</RequestId><HostId>OahjGsFQHlr3ihxobH/yyH7Mzxq98mwjcb6+J3Y2EifDU7FykCe8b6QJTNodIG5WSquVeJF+Zsk=</HostId></Error>

Steps to reproduce: run an ansible playbook using the following:

  • aws_ec2 inventory
  • aws_ssm connection type
  • specify an s3 bucket (ansible_aws_ssm_bucket_name var) that is in a different location to the target node

The presigned url generated includes the region the s3 bucket is in, so this region must be used for the session obtained in the _get_url function.

…n var (#1176)

SUMMARY

Fix issue where syntax error is reported if using ssm connection and the target node is located in a different region to the s3 bucket.

Fixes #1190, #637
ISSUE TYPE

    Bugfix Pull Request

COMPONENT NAME

aws_ssm connection plugin
ADDITIONAL INFORMATION

When using SSM for ansible connection and the target node is in a different region to the s3 bucket used, the playbook immediately errors with the following. (There are no issues when both target and s3 bucket are in the same region)

fatal: [i-04444a7f03cc2bffd]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"failed": true, "module_stderr": "", "module_stdout": " File \"/tmp/ansible/ansible-tmp-1653576081.8378458-29658-258097978113216/AnsiballZ_setup.py\", line 1\r\r\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\r\n ^\r\r\nSyntaxError: invalid syntax\r\r", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}

The tmp file has the following contents

<?xml version="1.0" encoding="UTF-8"?> <Error><Code>AuthorizationQueryParametersError</Code><Message>Error parsing the X-Amz-Credential parameter; the region 'us-east-1' is wrong; expecting 'eu-west-1'</Message><Region>eu-west-1</Region><RequestId>4VTAGR4C1V9ATBJT</RequestId><HostId>OahjGsFQHlr3ihxobH/yyH7Mzxq98mwjcb6+J3Y2EifDU7FykCe8b6QJTNodIG5WSquVeJF+Zsk=</HostId></Error>

Steps to reproduce: run an ansible playbook using the following:

    aws_ec2 inventory
    aws_ssm connection type
    specify an s3 bucket (ansible_aws_ssm_bucket_name var) that is in a different location to the target node

The presigned url generated includes the region the s3 bucket is in, so this region must be used for the session obtained in the _get_url function.

(cherry picked from commit 1be7da1)
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

✔️ ansible-galaxy-importer SUCCESS in 5m 17s (non-voting)
✔️ build-ansible-collection SUCCESS in 5m 13s
✔️ ansible-test-sanity-docker-devel SUCCESS in 11m 00s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 11m 01s
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 10m 47s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 11m 11s
✔️ ansible-test-units-community-aws-python38 SUCCESS in 6m 48s
✔️ ansible-test-units-community-aws-python39 SUCCESS in 8m 06s
✔️ ansible-test-splitter SUCCESS in 2m 43s
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Jun 30, 2022
@ansibullbot ansibullbot added bug This issue/PR relates to a bug community_review connection connection plugin new_contributor Help guide this first time contributor plugins plugin (any type) labels Jun 30, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

✔️ ansible-galaxy-importer SUCCESS in 4m 14s (non-voting)
✔️ build-ansible-collection SUCCESS in 5m 36s
✔️ ansible-test-sanity-docker-devel SUCCESS in 9m 25s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 11m 46s
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 11m 27s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 9m 56s
✔️ ansible-test-units-community-aws-python38 SUCCESS in 6m 40s
✔️ ansible-test-units-community-aws-python39 SUCCESS in 5m 59s
✔️ ansible-test-splitter SUCCESS in 2m 41s
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 9f44d3c into stable-3 Jun 30, 2022
@softwarefactory-project-zuul softwarefactory-project-zuul bot deleted the patchback/backports/stable-3/1be7da11d3f4f764372f9de17936e13f04ba66fc/pr-1176 branch June 30, 2022 13:26
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
…1290)

kms_key: Add multi region support to create_key

Signed-off-by: GomathiselviS [email protected]
SUMMARY


Fixes ansible-collections#1281
ISSUE TYPE


Feature Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Gonéri Le Bouder <[email protected]>
Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: GomathiselviS <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug community_review connection connection plugin mergeit Merge the PR (SoftwareFactory) new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants