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

aws_ssm connection: add support for SSM document #876

Conversation

blinkseb
Copy link
Contributor

SUMMARY

This PR adds support for SSM document to the SSM connection plugin.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

community.aws.aws_ssm

ADDITIONAL INFORMATION

The new document parameters is directly forwarded to the SSM start_session method.

Usage:

- name: Install a Nginx Package
  vars:
    ansible_connection: aws_ssm
    ansible_aws_ssm_bucket_name: nameofthebucket
    ansible_aws_ssm_region: us-west-2
    ansible_aws_ssm_document: nameofthecustomdocument
  tasks:
    - name: Install a Nginx Package
      yum:
        name: nginx
        state: present

@softwarefactory-project-zuul
Copy link
Contributor

Copy link
Contributor

@alinabuzachis alinabuzachis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also please add a changelog fragment?

plugins/connection/aws_ssm.py Show resolved Hide resolved
plugins/connection/aws_ssm.py Show resolved Hide resolved
@blinkseb
Copy link
Contributor Author

Thanks for your review! I added the changelog fragment and tried something for the integration tests

@marknet15
Copy link
Contributor

marknet15 commented Feb 4, 2022

@blinkseb It looks like the integration tests are currently disabled:
https://github.com/ansible-collections/community.aws/blob/main/tests/integration/targets/connection_aws_ssm/aliases

I'm not sure of the history of the past issues and if they are resolved or not etc, but you can try running them locally to verify all is working as expected you would need to specify the --allow-disabled flag so for example:

ansible-test integration --docker default -vvv connection_aws_ssm --allow-disabled

@ansibullbot ansibullbot added community_review connection connection plugin feature This issue/PR relates to a feature request integration tests/integration needs_triage new_contributor Help guide this first time contributor plugins plugin (any type) tests tests labels Feb 4, 2022
@blinkseb blinkseb force-pushed the feat-connection-ssm-document branch 4 times, most recently from 74583b7 to ad7c800 Compare February 7, 2022 13:16
@blinkseb
Copy link
Contributor Author

blinkseb commented Feb 7, 2022

ok I'm progressing. I re-enabled the integration tests, like it was done in #763. I'm currently stuck with a permission error to create a new SSM document, so I opened a PR to add the necessary permissions here: mattclay/aws-terminator#192

@markuman markuman added the backport-3 PR should be backported to the stable-3 branch label Feb 7, 2022
@markuman

This comment was marked as resolved.

@markuman
Copy link
Member

recheck

@softwarefactory-project-zuul

This comment was marked as resolved.

@markuman
Copy link
Member

markuman commented Dec 7, 2022

recheck

@softwarefactory-project-zuul

This comment was marked as resolved.

@markuman
Copy link
Member

markuman commented Dec 7, 2022

hmmm

"msg": "timed out waiting for ping module test: An error occurred (AccessDenied) when calling the PutObject operation: User: arn:aws:sts::966509639900:assumed-role/ansible-core-ci-test-prod/prod=remote=zuul-cloud is not authorized to perform: kms:GenerateDataKey on resource: arn:aws:kms:us-east-1:966509639900:key/5aa12287-6092-4fcc-9e8a-a08805e2706c because no identity-based policy allows the kms:GenerateDataKey action"

cc @gravesm

@gravesm
Copy link
Member

gravesm commented Dec 7, 2022

Sure, would you mind submitting a PR for the missing policy to https://github.com/mattclay/aws-terminator?

@markuman
Copy link
Member

markuman commented Dec 7, 2022

@blinkseb do you have some time to address the missing permission in a PR again?

@softwarefactory-project-zuul

This comment was marked as resolved.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

✔️ ansible-galaxy-importer SUCCESS in 4m 06s
✔️ build-ansible-collection SUCCESS in 5m 39s
✔️ ansible-test-sanity-docker-devel SUCCESS in 17m 58s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 9m 43s (non-voting)
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 10m 40s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 9m 04s
✔️ ansible-test-sanity-docker-stable-2.14 SUCCESS in 8m 47s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 6m 04s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 6m 28s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 7m 42s
✔️ ansible-test-units-amazon-aws-python310 SUCCESS in 7m 28s
✔️ ansible-test-changelog SUCCESS in 2m 31s
✔️ ansible-test-splitter SUCCESS in 2m 47s
✔️ integration-community.aws-1 SUCCESS in 12m 21s
✔️ integration-community.aws-2 SUCCESS in 10m 56s
✔️ integration-community.aws-3 SUCCESS in 6m 21s
⚠️ 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
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
⚠️ integration-community.aws-19 SKIPPED
⚠️ integration-community.aws-20 SKIPPED
⚠️ integration-community.aws-21 SKIPPED
⚠️ integration-community.aws-22 SKIPPED

@tremble tremble force-pushed the feat-connection-ssm-document branch 2 times, most recently from c95c1ef to d343232 Compare January 18, 2023 12:57
Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. I'm reworking the tests a little so that we can test things still work without an SSM document

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

✔️ ansible-galaxy-importer SUCCESS in 3m 52s
✔️ build-ansible-collection SUCCESS in 5m 15s
✔️ ansible-test-sanity-docker-devel SUCCESS in 9m 45s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 9m 47s (non-voting)
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 10m 14s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 10m 25s
✔️ ansible-test-sanity-docker-stable-2.14 SUCCESS in 11m 05s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 6m 36s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 5m 52s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 5m 46s
✔️ ansible-test-units-amazon-aws-python310 SUCCESS in 15m 49s
✔️ ansible-test-changelog SUCCESS in 2m 30s
✔️ ansible-test-splitter SUCCESS in 3m 14s
✔️ integration-community.aws-1 SUCCESS in 11m 01s
✔️ integration-community.aws-2 SUCCESS in 10m 55s
✔️ integration-community.aws-3 SUCCESS in 7m 49s
⚠️ 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
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
⚠️ integration-community.aws-19 SKIPPED
⚠️ integration-community.aws-20 SKIPPED
⚠️ integration-community.aws-21 SKIPPED
⚠️ integration-community.aws-22 SKIPPED

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Jan 18, 2023
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

✔️ ansible-galaxy-importer SUCCESS in 8m 05s
✔️ build-ansible-collection SUCCESS in 5m 39s
✔️ ansible-test-sanity-docker-devel SUCCESS in 10m 03s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 9m 58s (non-voting)
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 9m 55s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 15m 21s
✔️ ansible-test-sanity-docker-stable-2.14 SUCCESS in 9m 59s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 18m 29s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 6m 09s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 7m 39s
✔️ ansible-test-units-amazon-aws-python310 SUCCESS in 6m 41s
✔️ ansible-test-changelog SUCCESS in 2m 34s
✔️ ansible-test-splitter SUCCESS in 2m 39s
✔️ integration-community.aws-1 SUCCESS in 10m 44s
✔️ integration-community.aws-2 SUCCESS in 15m 16s
✔️ integration-community.aws-3 SUCCESS in 8m 07s
⚠️ 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
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
⚠️ integration-community.aws-19 SKIPPED
⚠️ integration-community.aws-20 SKIPPED
⚠️ integration-community.aws-21 SKIPPED
⚠️ integration-community.aws-22 SKIPPED

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit a1c35a1 into ansible-collections:main Jan 18, 2023
@patchback
Copy link

patchback bot commented Jan 18, 2023

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/a1c35a14541d9f8b755adacd275f5d2ac1ab31ef/pr-876

Backported as #1659

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 18, 2023
aws_ssm connection: add support for SSM document

SUMMARY

This PR adds support for SSM document to the SSM connection plugin.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME

community.aws.aws_ssm
ADDITIONAL INFORMATION

The new document parameters is directly forwarded to the SSM start_session method.

Usage:
- name: Install a Nginx Package
  vars:
    ansible_connection: aws_ssm
    ansible_aws_ssm_bucket_name: nameofthebucket
    ansible_aws_ssm_region: us-west-2
    ansible_aws_ssm_document: nameofthecustomdocument
  tasks:
    - name: Install a Nginx Package
      yum:
        name: nginx
        state: present

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Sébastien Brochet <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Mark Chappell <None>
(cherry picked from commit a1c35a1)
@blinkseb blinkseb deleted the feat-connection-ssm-document branch January 18, 2023 14:05
@blinkseb
Copy link
Contributor Author

Code looks good. I'm reworking the tests a little so that we can test things still work without an SSM document

thanks a lot!

@tremble
Copy link
Contributor

tremble commented Jan 18, 2023

@blinkseb Thanks for taking the time to submit this PR, I'm sorry it took quite so long to get everything working. With integration tests now in place hopefully we can start to clear some of the backlog around the SSM connection plugin.

tremble pushed a commit that referenced this pull request Jan 19, 2023
aws_ssm connection: add support for SSM document

SUMMARY

This PR adds support for SSM document to the SSM connection plugin.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME

community.aws.aws_ssm
ADDITIONAL INFORMATION

The new document parameters is directly forwarded to the SSM start_session method.

Usage:
- name: Install a Nginx Package
  vars:
    ansible_connection: aws_ssm
    ansible_aws_ssm_bucket_name: nameofthebucket
    ansible_aws_ssm_region: us-west-2
    ansible_aws_ssm_document: nameofthecustomdocument
  tasks:
    - name: Install a Nginx Package
      yum:
        name: nginx
        state: present

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Sébastien Brochet <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Mark Chappell <None>
(cherry picked from commit a1c35a1)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Jan 19, 2023
… for SSM document (#1659)

[PR #876/a1c35a14 backport][stable-5] aws_ssm connection: add support for SSM document

This is a backport of PR #876 as merged into main (a1c35a1).
SUMMARY


This PR adds support for SSM document to the SSM connection plugin.
ISSUE TYPE


Feature Pull Request

COMPONENT NAME

community.aws.aws_ssm
ADDITIONAL INFORMATION


The new document parameters is directly forwarded to the SSM start_session method.

Usage:
- name: Install a Nginx Package
  vars:
    ansible_connection: aws_ssm
    ansible_aws_ssm_bucket_name: nameofthebucket
    ansible_aws_ssm_region: us-west-2
    ansible_aws_ssm_document: nameofthecustomdocument
  tasks:
    - name: Install a Nginx Package
      yum:
        name: nginx
        state: present

Reviewed-by: Mark Chappell <None>
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
Add integration tests for aws_resource_actions

SUMMARY
Add some minimal integration tests for the aws_resource_actions callback plugin.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/callback/aws_resource_actions.py
ADDITIONAL INFORMATION
Combined with ansible-collections#873 we've got a full set...

Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-5 PR should be backported to the stable-5 branch community_review connection connection plugin feature This issue/PR relates to a feature request integration tests/integration mergeit Merge the PR (SoftwareFactory) needs_triage new_contributor Help guide this first time contributor plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants