Callback Provisioning with Ansible Tower

  • One big advantage to Tower is the REST API. This means hosts can do an API call to Tower and have Tower run a playbook against your host. One way I use it is we create a systemd timer and service in the post install section of the kickstart config. After a system reboots it waits for a predetermined time and does an API call to run the provisioning playbook to make sure the system is in compliance. This can be done at predetermined intervals also, like every 15 minutes.

    To enable this all you have to do is enable callback provisioning in your job template:


    It gives you the URL and the key. Tower ships with a script for the API call, but you can just use curl also. Here's an example:

    curl --data "host_config_key=d13a7b6e08e84c7d8f412b9754400a00" -k

    This will tell Tower to run job template 26 and add a limit of this host.

    Since the job is run from Tower, it's added to the system reporting and any job template options are applied also (like auto SCM updates).