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" https://tower.pa.jhbcomputers.com/api/v1/job_templates/26/callback/ -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).
-
Keeps giving me this
{"msg":"No matching host could be found!"}
any clues -
@Emad-R said in Callback Provisioning with Ansible Tower:
Keeps giving me this
{"msg":"No matching host could be found!"}
any cluesNot knowing much, I'd guess that you need to use the
host_config_key
of your host instead of his example. -
no the host key is accurate , if i changed it it gives another result saying permission denied
-
@Emad-R said in Callback Provisioning with Ansible Tower:
Keeps giving me this
{"msg":"No matching host could be found!"}
any cluesIs the host in your inventory? That's usually what you get if it's not.
-
It is, i added it even by IP and by hostname.
I wonder if this is related that i am running AWX in docker mode and if that is affecting it.
Btw do you know to install AWX without docker ?
-
@Emad-R said in Callback Provisioning with Ansible Tower:
It is, i added it even by IP and by hostname.
I wonder if this is related that i am running AWX in docker mode and if that is affecting it.
Btw do you know to install AWX without docker ?
Do you have PTR records set up for the host? I'm not sure if Tower looks at the IP or reverse name for the caller.
No it's Docker only. Only Tower has a non container based install.
-
-
@stacksofplates Thanks, good info. Im learning ansible now.