Best practices

Hi foreman community,

I’m working on migrate our installation infrastructure to foreman and would like to have some clues. Today everything is managed by scripts to build the templates matching the host (RH, Alma, Ubuntu, server, workstation, crypted or not, etc…).
I almost succeed to migrate the pxe, distributions repo and templates to foreman, for Almalinux, ubuntu and RH, but would like to improve our practices and reduce the number of provisioning templates we need. I thought ansible might help (we don’t use puppet. All our hosts are auto-updated every day using dnf-automatic and unattended-upgrades).
Is it possible to run a playbook to finalize a host when built ? I’m lost with ansible roles and it seems too complicated for our needs.
Thanks for help.
JF

There sure is! There’s one caveat though, AFAIC it’s only supported on RPM-based distributions. But have a read here:

and here:

https://docs.theforeman.org/nightly/Configuring_Ansible/index-foreman-el.html#provisioning-a-callback-for-a-host_ansible

If you don’t have AAP / AWX running, you could probably also use the process described in this functionality to work something out that has a similar function (e.g. making a call to a webhook of a different system that can start Ansible for you)