Problem: We are using foreman for provisioning our openstack nodes. Currently the Operating System nodes are on RHEL9 and we want to upgrade it RHEL9.2. As its a minor update so we are using yum/dnf to upgrade the OS(ansible) but we are still seeing the old OS entry in hammer CLI . Is there a way to update it?
hammer: there is hammer host update --operatingsystem or --operatingsystem-id
ansible: the theforeman.foreman.host module can update the OS as well, see the docs here
API: The host API endpoint also supports that. You can visit /apidoc on your foreman host to see the API docs for your Foreman version and all your installed plugins.
For the update to work, you will need to ensure that you have at least the OS set up and have associated the necessary parts like installation medium and provisioning templates correctly.
In theory, the workflow is designed so that the OS is updated through fact imports from either configuration management systems like Puppet or (if you are using katello) subsciption-manager. I assume you have none of these on the openstack nodes or you have disabled these updates intentionally?
My recommendation would be adding the Foreman callback to Ansible. This would not only update the Operating system from the gathered facts, but also the report from Ansible would be stored to have the information in one place. This can also be done without utilizing the Foreman Ansible plugin for running the job.