I've been playing with EC2 autoscaling for a while and my goal is to
start an instance update it and then save it to an AMI or use the
instance AMI id in a launch configuration tied to an auto scaling group
so that I have my instance up to date all the time and ready for scaling.
So I wanted to update the launch configuration using ec2_lc so that I
either use the newly generated AMI image or the image_id of the running
instance. The first doesn't work cause if I want to update the lc I
actually need to delete both autoscaling group and lc (and this is not
acceptable cause I have production instances running in the auto scaling
group, so deleting it will terminate those instances). The second
approach doesn't really work also cause I guess the ec2_lc module
doesn't support updating the lc or using the instance_id of my updated
instance in the lc, which is something that ec2 supports
(http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/create-lc-with-instanceID.html).
I could use the ec2 tools inside ansible but just wanted to see if
anyone had this issue before and how you solved it - without using Tower
of course.
Basically you just need to create a new launch configuration and then update it in the autoscaling group. Any new instances created in the autoscaling group will then use the new launch configuration.
True, but a custom module that deletes launch configs without images seems less clean than a custom module that returns launch config facts that you could then iterate over:
I’d favour adding a list state to ec2_lc rather than a custom ec2_lc_facts module (and similarly for ec2_ami), but you’re right, similar implementations have not made it through the pull review process. (Although ec2_vol and rds have similar capability)