Is there an Ansible module for creating 'instance-store' based AMI's?

独自空忆成欢 提交于 2019-12-13 06:45:24

问题


Creating AMI's from EBS backed instances is exceedingly easy, but doing the same from an instance-store based instance seems like it can only be done manually using the CLI.

So far I've been able to bootstrap the creation of an 'instance-store' based server off of an HVM Amazon Linux AMI with Ansible, but I'm getting lost on the steps that follow... I'm trying to follow this: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-instance-store-ami.html#amazon_linux_instructions

Apparently I need to store my x.509 cert and key on the instance, but which key is that? Is that...

  • one I have to generate on the instance with openssl,
  • one that I generate/convert from AWS,
  • one I generate with Putty, or
  • one that already exists in my AWS account?

After that, I can't find any reference to ec2-bundle-vol in Ansible. So I'm left wondering if the only way to do this is with Ansible's command module.

Basically what I'm hoping to find out is: Is there a way to easily create instance-store based AMI's using Ansible, and if not, if anyone can reference the steps necessary to automate this? Thanks!


回答1:


Generally speaking, Ansible AWS modules are meant to manage AWS resources by interacting with AWS HTTP API (ie. actions you could otherwise do in the AWS Management Console).

They are not intended to run AWS specific system tools on EC2 instances.

ec2-bundle-vol and ec2-upload-bundle must be run on the EC2 instance itself. It is not callable via the HTTP API.

I'm afraid you need to write a custom playbook / role to automate the process.

On the other hand, aws ec2 register-image is an AWS API call and correspond to the ec2_ami Ansible module. Unfortunately, this module doesn't seem to support image registering from an S3 bucket.



来源:https://stackoverflow.com/questions/42394774/is-there-an-ansible-module-for-creating-instance-store-based-amis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!