How to best use Ansible in an autoscaling environment?

126 views
Skip to first unread message

gr...@vestorly.com

unread,
Apr 22, 2015, 11:12:34 PM4/22/15
to ansible...@googlegroups.com
Hi all,

So I've been thinking about how to best use Ansible in an autoscaling environment on AWS, and I was wondering if anyone else had dealt with this, and if they had any advice.

My thought is to essentially do some kind of push/pull hybrid. Something like:

  • When a new instance comes online, have it pull an artifact (gz file, zip, etc.) from a known place on S3 - something like s3://bucket/latest.tar.gz. Unzip it into a known location, and run whatever commands to get it online.
  • When we're pushing a new version of the code out, update the latest artifact on the bucket, and from a central server, use the AWS module to find all instances with the same Name, and issue a command to force them to grab the latest copy and install.
  • The code would have some kind of playbook embedded in it, so after the latest copy is pulled down, that playbook just gets run.

In this way, we're not refreshing the code every n minutes via cron, and things stay more steady; the instances only update when they have to. I suppose another alternative is to have the instances access a Git repository and pull down the code from there, but then you have to deal with private repos.

Has anyone done anything like this?

Mark Phillips

unread,
Apr 25, 2015, 4:55:37 AM4/25/15
to ansible...@googlegroups.com
Hello,

I've done a lot of demos of this sort of thing using Ansible Tower's 'callbacks' feature. A playbook is exposed as a URL - embed a call to that URL[1] in user-data when spinning up an instance, and you have a 'phone home' solution that keeps the beauty of the push model.

--Mark


** Full disclosure and all that - I work for Ansible.

gr...@vestorly.com

unread,
Apr 27, 2015, 11:46:19 AM4/27/15
to ansible...@googlegroups.com
Thanks for the reply! That's the sort of solution I was looking for.

- greg
Reply all
Reply to author
Forward
0 new messages