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

DNM - Migrate modules ec2_launch_template and tests #2348

Conversation

abikouo
Copy link
Contributor

@abikouo abikouo commented Oct 18, 2024

  • Migrage modules ec2_launch_template and tests from collection community.aws.

jillr and others added 30 commits October 18, 2024 16:52
* Rename core collection

Rename references to ansible.amazon to amazon.aws.

* Rename community.amazon to community.aws
Fix pep8 line lengths for rewritten amazon.aws imports

* Missed a path in shippable.sh
* Dependency repos moved

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@235c5db
* Remove ANSIBLE_METADATA entirely, see ansible/ansible/pull/69454.
Remove `license` field from galaxy.yml, in favor of `license_file`.

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@05672a6
* Update docs

Remove .git from repo url so links in readme will generate correctly
Add required ansible version
Run latest version of add_docs.py
Add version_added string to modules

* galaxy.yml was missing authors

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@96ee268
…ns#61)

Clarified documentation surrounding using security_groups for any VPC other than Default.

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@25b9661
…tions#326)

* Mark ec2_launch_template tests as supported

* Update launch template test to use permitted harmless managed policy

* Make sure we delete the instance profile

* Cleanup imports

* use ansible_dict_to_boto3_tag_list

* Make sure retries are enabled

* Update role names in line with CI policy

* Lookup AMI name rather than hardcoding IDs

* Add changelog fragment

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4ad9fd3
…ns#467)

* Move ec2_launch_template to standard role-type test

* Run elb_application_lb in our standard environment

* Move elb_target_info to the standard role structure

* add remote_tmp_dir dependency to ec2_launch_template

* move test_multiple_actions_fail.yml inside full_test so we don't need to run the prep work twice

* Rename the ALBs: "my-alb" isn't helpful and resource prefix is likely to change on us

* Ensure ALBs are deleted if "failed" tests created something

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@887d624
…reate_launch_config (ansible-collections#413)

* ec2_launch_template - scrub None parameters from what we'll pass to create_launch_config
* tests
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@436c980
…ollections#371)

* Fix passing an instance profile arn to ec2_launch_template

If the string given on the iam_instance_profile looked like an arn, the
wrong structure format was being returned. boto3 expects a dict of the
format { arn: "{{ arn }}" } but the string was returned instead.

This fixes this error:
Couldn't create subsequent launch template version: Parameter validation failed:
Invalid type for parameter LaunchTemplateData.IamInstanceProfile, value: arn:aws:iam::[...]:instance-profile/[...], type: <class 'str'>, valid types: <class 'dict'>

* integration test
* changelog
Co-authored-by: Mark Chappell <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b528eaa
These modules have been migrated to amazon.aws in
amazon.aws/pull/354

Update runtime.yml with redirects to that collection

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@9456494
This collection has been operating on Zuul CI for some weeks now

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4e0d83c
The new tiny_prefix variable has recently been introduced. It's
a 12 characters long string that is reused for the whole job.

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4d1fa5a
Improve doc of ec2_launch_template module

SUMMARY

Add information about how the ec2_launch_template handles initial creation of the launch template, or creation of a new version of the launch template.

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

ec2_launch_template
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Mark Woolley <[email protected]>
Reviewed-by: Mark Chappell <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@37d758e
…ections#917)

ec2_launch_template: implement missing metadata options

SUMMARY
Add missing metadata options

instance_metadata_tags
http_protocol_ipv6

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_launch_template

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Mark Woolley <[email protected]>
Reviewed-by: Alina Buzachis <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@d47e188
[4.0.0] Bump minimum botocore version to 1.20.0

SUMMARY
With the next major version we can bump botocore/boto3 again.  Since 1.20.0 is now over a year old, we can bump the minimum version in preparation for 4.0.0.  CI should still test backports against the relevant versions for the backported release.
1.20.0 was released 2021-02-02.
1.21.0 was released 2021-07-15, hopefully we'll release 4.0.0 before July.
Should we release after mid-July we can always bump again.
( Follow up to ansible-collections#692 )
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
requirements.txt
ADDITIONAL INFORMATION
botocore] $ git show 1.20.0
tag 1.20.0
Tagger: aws-sdk-python-automation <[email protected]>
Date:   Tue Feb 2 19:11:44 2021 +0000

Tagging 1.20.0 release.

commit b7d27dc39aea82e22e2c11443fbd02a4904367cd (tag: 1.20.0)
Merge: cc497a593 27ebea65f
Author: aws-sdk-python-automation <[email protected]>
Date:   Tue Feb 2 19:11:44 2021 +0000

    Merge branch 'release-1.20.0'

    * release-1.20.0:
      Bumping version to 1.20.0
      Update to latest models
      Add changelog for custom endpoints and ARN resources
      Allow custom endpoints when addressing ARN resources
      Add changes for Python 3.4/3.5 removal
      Fall back to Transfer-Encoding 'chunked' if AWSRequest body is not seekable stream

boto3] $ git show 1.17.0
tag 1.17.0
Tagger: aws-sdk-python-automation <[email protected]>
Date:   Tue Feb 2 19:11:35 2021 +0000

Tagging 1.17.0 release.

commit 1a35ed1ab41f967ea43420650075f2693cbbe08b (tag: 1.17.0)
Merge: d77d24f9 35454bc5
Author: aws-sdk-python-automation <[email protected]>
Date:   Tue Feb 2 19:11:35 2021 +0000

    Merge branch 'release-1.17.0'

    * release-1.17.0:
      Bumping version to 1.17.0
      Add changelog entries from botocore
      Add S3 VPCE examples
      Add changes for Python 3.4/3.5 removal

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Markus Bergholz <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@d649e37
…ansible-collections#1067)

In integration tests use a common AMI rather than hard coded per test

Depends-On: ansible-collections#1068
SUMMARY
Rather than hard coding the AMIs on a per-test basis, use a common AMI defined in setup_ec2_facts
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_asg_instance_refresh
ec2_asg_lifecycle_hook
ec2_asg_scheduled_action
ec2_launch_template
ec2_lc
ec2_metric_alarm
ec2_scaling_policy
elb_network_lb
elb_target
elb_target_info
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Jill R <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@3f434f3
Integration test dependency cleanup

SUMMARY

remove dependencies on setup_remote_tmp_dir where it's not used (often just copy & paste from another test)
remove setup_ec2 (no main.yml means it's not doing anything)
remove prepare_tests (empty main.yml means it's not doing anything)

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
tests/integration/targets
ADDITIONAL INFORMATION
By cleaning up what we have we reduce the chance of people copying things about "because that's what test XYZ did".

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mark Woolley <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@dd12046
…#1204)

Tagging - Add resource_tags as an alias for tags

SUMMARY
There are a number of modules where we always create a fresh resource.  For now let's just add resource_tags, long term it would be good to add purge_tags and use the docs fragment.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/modules/data_pipeline.py
plugins/modules/ec2_ami_copy.py
plugins/modules/ec2_launch_template.py
plugins/modules/ecs_task.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@11fcdea
…ctions#239)

Add source_version param to ec2_launch_template module

SUMMARY
Add support for Boto3.create_launch_template_version's source_version parameter.
Accepted values:

int (specific version) : Creates a new launch template using this version as the base, hence keeping all its parameters
string ( 'latest') : Uses the latest found in list template_versions

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_launch_template.py
ADDITIONAL INFORMATION
Sanity tests passed for this module.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Joseph Torcasso <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@279bbc9
Rename autoscaling modules

SUMMARY
Rename the autoscaling modules based on the new naming scheme
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/modules/autoscaling_group.py
plugins/modules/autoscaling_group_info.py
plugins/modules/autoscaling_instance_refresh.py
plugins/modules/autoscaling_instance_refresh_info.py
plugins/modules/autoscaling_launch_config.py
plugins/modules/autoscaling_launch_config_find.py
plugins/modules/autoscaling_launch_config_info.py
plugins/modules/autoscaling_lifecycle_hook.py
plugins/modules/autoscaling_policy.py
plugins/modules/autoscaling_scheduled_action.py
plugins/modules/ec2_asg.py
plugins/modules/ec2_asg_info.py
plugins/modules/ec2_asg_instance_refresh.py
plugins/modules/ec2_asg_instance_refresh_info.py
plugins/modules/ec2_asg_lifecycle_hook.py
plugins/modules/ec2_asg_scheduled_action.py
plugins/modules/ec2_lc.py
plugins/modules/ec2_lc_find.py
plugins/modules/ec2_lc_info.py
plugins/modules/ec2_scaling_policy.py
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@8721cf6
Botocore test requirement cleanup

SUMMARY
When updating the minimum botocore/boto3 for the collection, I missed cleaning up some of integration tests which no longer need a newer version than the collection supports
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
tests/integration/targets/autoscaling_launch_config
tests/integration/targets/ec2_launch_template
tests/integration/targets/wafv2
tests/integration/targets/wafv2_web_acl
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@e9a9247
alinabuzachis and others added 13 commits October 18, 2024 16:52
…collections#1459)

Update extends_documentation_fragment with amazon.aws.boto3

Depends-On: ansible/ansible-zuul-jobs#1654
SUMMARY

As per ansible-collections#985 add amazon.aws.boto3.

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

several

Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@bd3c03f
…ons#1632)

Ansible User-Agent identification for community.aws

SUMMARY

The value will be similar to this APN/1.0 Ansible/2.14.1 community.aws/6.0.0-dev0

ISSUE TYPE

Feature Pull Request

Reviewed-by: Mark Chappell <None>
Reviewed-by: Bikouo Aubin <None>
Reviewed-by: Alina Buzachis <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@a8cbce2
Cleanup headers and imports

SUMMARY
Mass update of imports, docs fragments and file headers

Many of the amazon.aws module_utils and docs fragments got moved about, update community.aws to reflect this.
Consistently apply the comment headers as documented at https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#python-shebang-utf-8-coding

ISSUE TYPE

Docs Pull Request
Feature Pull Request

COMPONENT NAME
ADDITIONAL INFORMATION
Header cleanup based upon:
https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#python-shebang-utf-8-coding

Begin your Ansible module with #!/usr/bin/python - this “shebang” allows ansible_python_interpreter to work. Follow the shebang immediately with # -*- coding: utf-8 -*- to clarify that the file is UTF-8 encoded.

and
https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#copyright-and-license

After the shebang and UTF-8 coding, add a copyright line with the original copyright holder and a license declaration. The license declaration should be ONLY one line, not the full GPL prefix.
...
Additions to the module (for instance, rewrites) are not permitted to add additional copyright lines other than the default copyright statement if missing:

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@a4f20bf
[6.0.0] Bump botocore requirements

SUMMARY
In line with our botocore version policy bump the minimum requirements

Starting with the 2.0.0 releases of amazon.aws and community.aws, it is generally the collection's policy to
support the versions of botocore and boto3 that were released 12 months prior to the most recent major
collection release, following semantic versioning (for example, 2.0.0, 3.0.0).

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
requirements.txt
ADDITIONAL INFORMATION

boto3 - 1.22.0 - "Mon Apr 25 18:07:20 2022 +0000"
botocore - 1.25.0 - "Mon Apr 25 18:07:02 2022 +0000"

See also ansible-collections#1342

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4baf1cf
)

Add version_description to ec2_launch_template

SUMMARY
Add version_description to ec2_launch_template module, which allows user update the VersionDescription of a launch template.
Fix ansible-collections#1762

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

ec2_launch_template
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@3c3698d
* Black prep

* Black

* changelog

* Fix pylint unused-import in tests

* Split SSM connection plugin changes

* disable glue tests - bucket's missing

* Disable s3_logging and s3_sync tests

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@2c4575c
Bulk migration to Python 3.6 f-strings

SUMMARY
We've dropped support for Python <3.6, bulk migrate to fstrings and perform some general string cleanup
A combination of

black --preview
flynt
some manual cleanup

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/
tests/
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@de33821
Various ARN handling fixes

Depends-On: ansible-collections#1619
SUMMARY
fixes: ansible-collections#1846
Various modules had hard-coded ARN handling which assumed the use of the main  partition.  This causes problems for folks using Gov Cloud (and aws-cn)
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/batch_compute_environment.py
plugins/modules/ec2_launch_template.py
plugins/modules/elasticache_info.py
plugins/modules/iam_group.py
plugins/modules/iam_role.py
plugins/modules/msk_config.py
plugins/modules/redshift.py
plugins/modules/sns_topic.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@25a636c
…ollections#1921)

Mass update of docs and tests (credentials/session tokens)

SUMMARY
We had a cleanup of credentials/session parameters which included a batch of deprecations and renames.
Ensure that all of our tests and docs are using the 'canonical' names
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
plugins/modules/batch_compute_environment.py
plugins/modules/cloudformation_exports_info.py
plugins/modules/ec2_vpc_vpn.py
plugins/modules/elasticache.py
plugins/modules/elasticache_parameter_group.py
plugins/modules/elasticache_snapshot.py
plugins/modules/ses_rule_set.py
plugins/modules/sts_assume_role.py
plugins/modules/sts_session_token.py
tests/integration
ADDITIONAL INFORMATION
See also

ansible-collections#1172
ansible-collections#1714

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4a5b50e
[7.0.0] Bump botocore requirements

SUMMARY
In line with ansible-collections#1763 bump our botocore requirements for 7.0.0
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
README.md
changelogs/fragments/botocore.yml
changelogs/fragments/python37.yml
plugins/modules/dynamodb_table.py
plugins/modules/ec2_launch_template.py
plugins/modules/networkfirewall_policy.py
plugins/modules/networkfirewall_rule_group.py
plugins/modules/networkfirewall_rule_group_info.py
plugins/modules/opensearch.py
plugins/modules/opensearch_info.py
plugins/modules/s3_lifecycle.py
plugins/modules/wafv2_web_acl.py
requirements.txt
tests/config.yml
tests/integration/constraints.txt
tests/unit/constraints.txt
ADDITIONAL INFORMATION
Deliberately links to the amazon.aws PR to avoid duplicating the reasons.

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b753fe5
amazon.aws 8.0.0 deprecations - test cleanup

SUMMARY
iam_role moved all of the return values under .iam_role, rather than returning a tangled mess at the top level
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
tests/integration/targets/config/tasks/main.yaml
tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml
tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml
tests/integration/targets/eks_cluster/tasks/full_test.yml
tests/integration/targets/eks_fargate_profile/tasks/create_eks_cluster.yml
tests/integration/targets/eks_fargate_profile/tasks/full_test.yml
tests/integration/targets/eks_nodegroup/tasks/dependecies.yml
tests/integration/targets/eks_nodegroup/tasks/full_test.yml
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@5cb20f7
…#2164)

SUMMARY

Depends-On: ansible-collections#2319

Add some type hint for the module
Use shared code from amazon.aws.plugins.module_utils.ec2
Add the possibility to delete specific version of a launch template
Add support for tagging for launch template resource (Closes ansible-collections#176)
Add the possibility to tag specific resources, not always instance and volume (Closes [ansible-collections#48](ansible-collections#48, Closes ansible-collections#2083)
Support EBS Throughput (Closes ansible-collections#1944)
Fix issue occurring when launch template contains more than 200 versions (Closes ansible-collections#2131)

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

ec2_launch_template

Reviewed-by: Alina Buzachis
Reviewed-by: Bikouo Aubin
Reviewed-by: GomathiselviS <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@40d61f0
Copy link

github-actions bot commented Oct 18, 2024

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/b0b9d5b7c5904446931cd9b795d34149

✔️ ansible-galaxy-importer SUCCESS in 5m 18s
✔️ build-ansible-collection SUCCESS in 12m 12s
✔️ ansible-test-splitter SUCCESS in 4m 42s
✔️ integration-amazon.aws-1 SUCCESS in 8m 29s
✔️ integration-community.aws-1 SUCCESS in 7m 16s
Skipped 42 jobs

@GomathiselviS GomathiselviS merged commit 745d412 into ansible-collections:main Oct 24, 2024
34 of 35 checks passed
softwarefactory-project-zuul bot pushed a commit to ansible-collections/community.aws that referenced this pull request Oct 25, 2024
Depends-On: ansible-collections/amazon.aws#2348

Remove ec2_launch_template modules and tests, these modules have been migrated to amazon.aws collection.
Update runtime.yml with redirects to that collection
Update ignore files

Reviewed-by: Alina Buzachis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.