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
Add an ec2_import_snapshot module #62630
Conversation
@bcl, just so you are aware we have a dedicated Working Group for aws. |
The test
The test
|
387a6f4
to
5081022
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ec2_snapshot_import
might be a better name, to parallel ec2_snapshot_copy
.
ec2_snapshot
and ec2_snapshot_copy
support setting tags on the created snapshot; it would be nice if this module had feature parity.
Since this is a new module it needs integration tests; see https://docs.ansible.com/ansible/devel/dev_guide/platforms/aws_guidelines.html#integration-tests-for-aws-modules
I wondered about that, either way is fine with me -- I was following the function name.
Looks like that's pretty easy to add.
This is a hard one, I think. In order to do that you need an ami file in a s3 bucket to import. I'm using this as part of https://weldr.io/lorax/lorax-composer.html so I can make my own images, but I have no idea how to do something like that with the ansible test infrastructure. So suggestions are welcome :) |
5081022
to
9688531
Compare
The test
|
9688531
to
91ead5c
Compare
The test
|
91ead5c
to
0400a68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some integration tests.
[edit] Hmm, just seen the previous comments, ergh, not 100% sure how to test
if not url and not (s3_bucket and s3_key): | ||
module.fail_json(msg='url or s3_bucket and s3key are required.') | ||
if all([url, s3_bucket, s3_key]): | ||
module.fail_json(msg='url or s3_bucket and s3key are required, not all 3.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are made redundant by mutually_exclusive, required_one_of and required_together below.
This uses the boto3 import_snapshot function to import a disk image from s3 as a snapshot. It also allows setting name:value tags on the new snapshot.
0400a68
to
6066484
Compare
@BobBoldin @Constantin007 @Constantin07 @Deepakkothandan @Etherdaemon @Java1Guy @Madhura-CSI @MichaelBaydoun @Sodki @Zeekin @adq @aidan- @akazakov @alachaum @aljazkosir @amir343 @anryko @axc450 @bekelchik @brandond @captainkerk @carchi8py @chenl87 @defunctio @dennisconrad @dkhenry @fiunchinho @fivethreeo @flowerysong @garethr @gobins @gunzy83 @gurumaia @hsingh @hyperized @iiibrad @infectsoldier @j-carl @jarv @jimbydamonk @jmenga @joelthompson @jonhadfield @jonmer85 @jsdalton @jsmartin @kaczynskid @leedm777 @linuxdynasty @loia @lwade @markuman @matt-telstra @michaeljs1990 @miha-plesko @mikedlr @minichate @mjschultz @mmochan @mmoyle @mpechner @nand0p @naslanidis @nathanwebsterdotme @nerzhul @nickball @orthanc @ozbillwang @piontas @pjodouin @prasadkatti @psykotox @ptux @pwnall @raags @rafaeldriutti @rickmendes @roadmapper @rrey @ruimoreira @ryansydnor @sbj-ss @scicoin-project @scottanderson42 @sdubrul @shepdelacreme @silviud @slapula @stefanhorning @steynovich @tastychutney @tdekeyser @tgerla @timmahoney @tomislacker @tremble @tsiganenok @viper233 @waffie1 @whiter @willricardo @wilvk @wimnat @xlab-si @yaakov-github @zacblazic @zbal @zimbatm As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add |
Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.
For further information, please see: |
This uses the boto3 import_snapshot function to import a disk image from
s3 as a snapshot.
SUMMARY
This is a wrapper around the boto3 import_snapshot function. It allows you to import a disk image from an S3 bucket as a snapshot, which can then be registered as an AMI.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.import_snapshot
It seemed to fit better as its own module instead of adding it to ec2_ami or one of the ec2_snapshot modules.
ISSUE TYPE
COMPONENT NAME
ec2_import_snapshot
ADDITIONAL INFORMATION