Hi Everyone - pretty new to Foreman/Katello/Ansible. Switching from Spacewalk.
I have a bunch of servers we’re moving to Foreman from Spacewalk. We’re using the Katello bootstrap python script to add the host to Foreman, assign it repositories and add it to a host group. This host group has a bunch of Ansible Roles assigned to it.
The client shows up in Foreman, I can see it in the host group, but after it gets added, the Ansible roles are never run on the host.
If a deploy a new VM directly from Foreman, everything works fine, including the Ansible roles.
As far as I know, the Ansible callback is enabled, but I’m a bit stumped on troubleshooting this issue. Any help is appreciated. Thanks!
never applied on their own or never applied even if you explicitly run the job to apply them?
I’m afraid roles currently do not get automatically applied to hosts upon registration, if that’s what you’re after. They should get applied as part of the provisioning or when you explicitly run a job to apply them. If you’d like the roles to be applied upon registration, feel free to open an RFE at our issue tracker.
Since best practice is to have idempotent roles, would it be an option for you to have a recurring job which would apply the roles periodically to all hosts in the hostgroup? Or at least as a workaround for the time being
Well that’s not what I was hoping for. Our developers manage and clone machines from running VM’s and templates in VMware. Also, it appears Foreman is incapable of cloning a VM that was not created by Foreman itself. So all the existing VM’s, they would need to clone from within VMWare and go back to foreman to run roles.
I’m trying to reduce the complexity for them and reduce IT involvement.
Is it possible to call a Foreman API from the client that will kick off the Role deployment?
I’ve just tested it and it seems to be working (with the fix of course). I guess it’s obvious, but with webhooks for such task you don’t need to search for host ids by its names as you would do via API or hammer, which could save you a few API calls. Also in such manner you can trigger any Foreman API endpoint based on any event (one should be extra careful, it might flood the server)
Although it sounds useful in case of one host creation once in a while (you don’t forget anything, since playing roles will be automated), but in case if you want to create a bunch of host at first, then probably it might be better to use bulk play roles endpoint, so you cover all the hosts at once instead of each.