Need to Migrate all hosts from Centos 7 to other OS Expected outcome:
The Hosts should have all the current Data and Build with New OS Foreman and Proxy versions:
Foreman and Proxy version 2.2.3 Foreman and Proxy plugin versions:
Distribution and version:
Cent OS 7 Other relevant data:
We have the Organization setup with numbers of hosts and we want the hosts to be moved to Another OS
There is no bulk action for changing OS in Foreman afaik. I would suggest using either hammer or the API for such a task (whatever you prefer).
With hammer, a simple shell loop over hammer host list (with optional search if needed) into hammer host update --name <name from loop> --medium <your centos8 medium> --partition-table <your partition table> should do the trick. In case you have several partition tables you need to use, you can use some grep/sed/awk/whatever tricks on hammer host info --name <hostname> to find the ptable a system is currently using. I don’t think there is a hammer command for rebuilding a host/setting it in “build” state, but you can do that via bulk action in the UI; go to the all hosts page, select your systems (either by hand or via the “select all” checkbox), then click “Select Action” → “Build Hosts”.
The API workflow should be generally the same, just use the API instead of hammer. You can find the API docs on your Forman server under https://yourforeman.example/apidoc. The API should also have an endpoint for putting hosts in build mode.
You then just have to reboot the hosts to have them rebuild with the new OS. Depending on if and which virtualization solution you use, you might also be able to do this while putting the hosts in build mode.
In case you are using Katello for repository management, there will be some additional settings you will have to adjust, but the same principal applies.
In that case, you will most likely also need to change content views for the hosts, depending on your setup.
I am not aware of any way to do this in the UI, at least not in a bulk way. You could edit each host and change the OS, content view and what not, but depending on the number of hosts you have this could become very tedious and time consuming.
There is also a guide in the docs on how to upgrade hosts from RHEL7 to RHEL8 using LEAPP, if you want to go that route: Managing Hosts
There is no direct way of doing this. You have several options how to do this, depending on your setup one might be better suited to you.
If you only want to register the hosts to a new Foreman server, the easiest way would be to ensure you have setup your your new Foreman with all products, content views, etc and execute a script via remote execution on the hosts. That script should perform (at least) subscription-manager unregister; yum remove katello-ca-consumer-*; yum install <url to new katello-ca-consumer package>; subscription-manager register --activationkey=<yourkeys>.
If you need to migrate all the data in Foreman to a new Foreman, that’s more complicated. Some people have done this by dumping and reimporting the complete database, but there might be dragons. You can search the forums for a lot of posts and threads on this topic I guess.
There are probably more possible options, but no “out-of-the-box” ones.
Also, a general word of warning: Your Foreman Version is quite old. I would strongly suggest upgrading to a more recent version, not only for the sake of upgrading and keeping your system supported, but also because your Katello version will probably not be able to handle EL8 modular repos well, or at all. You should at least upgrade to Katello 4.0 (which is Foreman 2.4 afaik) and do the migration to pulp3. I also assume that the foreman-leapp plugin from the docs I linked above will not be available for Foreman 2.2.
Yes we want to upgrade it to newer version of Foreman and that is the reason we are trying to migrate it to another server. Is there a way we can update it to the new version of foreman without migrating
to another foreman server
Absolutely! There are docs for that. For upgrading from 2.2 to 2.3 (which is Katello 3.18), follow this documentation: Foreman :: Plugin Manuals
After that, you should also perform the Pulp3 migration, the docs for that can be found on the same page.
After that, follow the docs at https://docs.theforeman.org/, for each version there is an upgrade guide that explains the steps you need to take (mostly the same for each version, but sometimes there might be version specific steps you need to take, so read each versions upgrade guide).
Please also note that you need to upgrade one minor release at a time and can not skip releases, so you need to do 2.2 → 2.3 → 2.4 → 3.0 → etc in order. I suggest taking a offline snapshot or full system backup (with all Foreman services and DB beeing shut down) before you start so can revert to the current working state in case something breaks. I also recommend scheduling a long downtime, each Foreman version upgrade can easily take 30 Minutes and the pulp3 Migration can take hours depending on how many repos and packages you have synced. Most of the Pulp3 Migration can be done online, though, if you want to split the work over several downtimes.
How many hosts do you manage. If you migrate from such an old version you’ll carry quite a lot of baggage which may not be cleaned up in the databases. The pulp2 to 3 migration was also not without issues.
If it’s not too many hosts, you may consider setting up a new server.
Please also remember, that support for running foreman servers on CentOS 7 ended with foreman 3.3/katello 4.5. The current 3.4/4.6 does not support centos 7 anymore.
Thus, you could go through the hassle of upgrading your current server all the way to 3.3, then create a backup and restore the backup on a new installation with el8. But all things considering, I doubt that’s really a good idea, if you make it to 3.3 without any major issues. Setting up a new server might be much easier.
I’ve used the foreman-ansible collection for my new foreman server on el8 to built tasks to set up most of the system just like my old server. It doesn’t cover everything, yet, but I got pretty far with it.
Then I have pointed my clients to the new foreman server for puppet and content and used a simple shell script to restore the repository set…
I have Over 1000 hosts and all on CentOS 7 and what would be the best way. Upgrading seems like a tedious way to do . what has to be done here if we set up new server how do we add all the hosts from current foreman server to New Foreman server