Hi Guy!
I’m not an expert on this module because it’s my coworker who wrote it and not me, so I’ll try to give you as much good advice as I can. So I think the issue here is that the autoscale groups don’t return data about the servers they may create or delete. Correct me if I’m wrong in my understanding.
So, this isn’t an issue with the module per se, it’s more of an issue with the way that ASGs operate – you create ASGs and they in turn create servers, or delete them, work on load balancers, etc.
Ansible won’t know about these servers until you run the dynamic inventory script again.
There are three ways to handle this, I think:
- ansible-pull
- tower + webhooks
- bake-in ansible-pull into the image so that it ansible-pulls on boot
The first two methods will take advantage of cloud-init, essentially. So,
- For ansible-pull you’ll need to cloud-init install ansible-pull ont he machine as it comes online, and when it does, it pulls down a git repo, and “Ansibles” itself.
- But for Tower & Webhooks, when a server comes online, have it use a cloud-init webhook to call back to a Tower server, which would then kick of a playbook of some kind
- Baking in ansible-pull is really simple but requires work ahead of deployment; can’t be done afterwards via ansible in they way you desire (you could write a playbook to do this before hand, though!)
When you’re working with Autoscale, cloud-init is your new BFF. It’ll handle the stuff you’re looking to do.
There’s more documentation about cloud-init around. Here’s a started article:
https://developer.rackspace.com/blog/using-cloud-init-with-rackspace-cloud/
And this is a repo made by a Racker specifically covering getting Autoscale working with cloud-init.
https://github.com/devx/autoscale_cloudinit
Essentially, when you set up your autoscale configuration, you’ll need to pass some custom data, base64 encoded a la the webdocs:
http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/Manage_Launch_Configuration.html
http://docs.rackspace.com/servers/api/v2/cs-devguide/content/config_drive_ext.html
Please note that the current implementation of the rax_autoscale_group does not allow you to work with cloud-init, but I have an idea of how I might go about adding such functionality. Apologies for the inconvenience.