Autoscaling using Callback
So far, we have looked at methods where we have invoked the templates manually. However, in a cloud infrastructure, we often scale infrastructure dynamically. As a result, executing jobs manually can be time-consuming. Ansible Tower provides us a way so that instances can call the jobs themselves without actually using the password. The concept where an instance calls up a job is called a Callback, so let's go ahead and create a Callback URL.
How to do it...
- We should go to the
Templates
page and click on the name of the template. - Here, we need to scroll down to the options and check
Allow Provisioning Callbacks
. - We have to provide a config key. Ideally, this should be a long string. We can also click on the wand button next to the host config key to generate a random string, and then we can click on the
SAVE
button.

- Any instance can call for the job using the Callback URL. Typically, this can be done through curl in
/etc/rc.local
, or by using the various mechanisms...