Upgrade Foreman from V1.2 to V3.0

Hi Folks,

We have Foreman V1.2 and it was not upgraded for quite long period of time. However now we are looking to upgrade it to latest version V3.x.
I came to know there is no direct upgrade from lower to latest.
Hence checking if we have any best approach to handle this upgradation.


the only intended and tested upgrade path is upgrading one version at a time until you reach the target version, so 1.2 → 1.3 → 1.4… → 3.1
Since 1.2 is a really old version, you might be off faster setting up a fresh 3.1 install and migrating you data and hosts over, but the effort for that depends a lot on the size of your current installation.




I’m on the same situation.
@areyus : how can I migrate data and hosts on a 3.1 fresh install please ? (I’ve not found information about that into the documentation)

Thank you

There is no documentation on that topic for a reason. It is not just a straight forward process and depends a lot on the features you are using.
You should be able to import your hosts into a new system rather easily through config management reports/subscription manager facts if you use any of those features, but you will have to move everything like smart-class parameter, settings, etc by hand where necessary. You will also have to create things like Katello content repositories, content views, etc again if you are using Katello.
A lot of this can probably be automated through API calls or hammer commands, but you will need to identify everything you need to move and how to do this yourself, since only you know your setup.

thank’s @areyus
It’s dead for me, shame there are no tools :-/

You could look into re-engineering your Foreman setup using Ansible, that way you can re-created it anytime at a whim (e.g. to test upgrades, or to do a disaster recovery etc.)

You can find the modules here: Theforeman.Foreman — Ansible Documentation
I wrote a blog post about it a while ago: Foreman :: Foreman Config as Code

This is another blog about integrating it with AWX and FreeIPA: Foreman :: Automating Systems with Foreman, AWX, and FreeIPA

And IMHO, this is the only sound way of doing this, as you don’t want to have your infrastructure’s health depending on some configuration you made by hand with a lot of effort. There’s a lot of merit in automating it away.

Manual configs are only useful if you’re still figuring out how to automate it :slight_smile: but in the long run, even the time you invested in automation will return itself more then once.

1 Like

While it’s not technically supported (and wouldn’t try it with Katello), I would generally think that you can migrate your database. So you can do:

  • Fresh installation of Foreman 2.0
  • Stop all services
  • Wipe the database
  • Import your Foreman 1.2 database
  • Run foreman-rake db:migrate && foreman-rake db:seed
  • Upgrade it to Foreman 3.0

@ekohl , Just curious to know if you have implemented above steps?

No, but I know of people who have done it. Granted, not such a big jump but we didn’t really remove migrations prior to 2.0 and still rarely do. The installer lays out files and configurations to match so in general I’d expect it to work. Of course I would recommend backups, but if you’re installing a fresh machine with Foreman 2.0 you still have your old machine running.

Ok @ekohl . Thank you for feedback.

Got query , while reviewing upgrade document , i could see we need to run

rpmconf -a --frontend=vimdiff

Is it optional or mandatory to perform after each upgrade.

Also, what if i selected option " N or O : keep your currently-installed version" , will it cause any issue while upgrade.
Also, is there automated way to merge rpmnew and existing file.