Deregister EC2 instances from an ELB one by one, transnsfer a .deb package & install and register each onto same ELB back.

18 views
Skip to first unread message

Raj Boruah

unread,
May 16, 2016, 8:34:43 AM5/16/16
to Ansible Project
Hi,

I am new to Ansible and trying to automate the following scenario on AWS:

1) Get the instance ids registered to an elb from within an elb. (I do not want to specify the instaces in a harcoded way)
2) Deregister one instance and perform my needed operation in that instance (e.g. edit /var/lib/monit/id ) 
3) Register that instance back into the same elb. Repeat the same until all instances in that elb are updated/upgraded.

I tried follwoing:

- ec2_elb_facts for instance ids (it does not provide host name or public ids) and create a group for the instances
- ec2_elb to deregister instances using the group created above
- I am not sure how to log into the instances on the fly as ec2_elb_facts does not provide hostname or IPs.

Can anyone please help me on this ? If anyone can provide me the scripts, that would be of great help.

Thanks,
Raj.
Reply all
Reply to author
Forward
0 new messages