Problem:
After migrating to a new host the installer does not read my ‘old’ config
Expected outcome:
Should read the old config
Foreman and Proxy versions:
1.21
Foreman and Proxy plugin versions:
Distribution and version:
CentOS 7.7
Other relevant data:
I know the OS Version AND the foreman version is old.
But I try to migrate from Ubuntu 16.04 to CentOS and I do not want
to change too many things at once.
I dumped and restored the psql
The web interface looks fine already (all the host are visible,…) and
the LDAP authentication is working as well
I copied all files in /etc/foreman to the new server.
But if I run ‘foreman-installer -i’ all settings are on default.
What I have to do that the installer uses/read the config from the machine?
Thank you for your hint!
The file:
/etc/foreman-installer/scenarios.d/foreman-answers.yaml
did the trick
But now this error occurs: '/usr/bin/initdb --encoding '' --pgdata '/var/lib/pgsql/data'' returned 1 instead of one of [0]
If I check the command manually I get: initdb: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
However I do not want that the installer to initializes a new database because
it is already there and filled with data.
Why does the installer does not recognize the data base?
Changing from Ubuntu to CentOS can cause a lot of paths to change because the packaging is different in various places. That can cause a lot of issues. Normally I wouldn’t recommend manually changing answer files, but in this highly unusual thing I’d recommend to go over it and see which are values you’ve changed. If you didn’t, the delete the line. Since it’s a fresh server, that should still be rather safe.
Note that the installer also has a --noop flag which will show you what it would change.
In the future, it’s also helpful to get the log from /var/log/foreman-installer.
Maybe my postgres installation is the real problem.
I installed it from scratch. (It is not the version shipped with CentOS!)
The standard (postgres) path is: /var/lib/pgsql/11/data
But the foreman-installer is looking for this path: /var/lib/pgsql/data
So I created a sym link from /var/lib/pgsql/11/data to /var/lib/pgsql/data
But after the installer has run the link is vanished and a real empty directory has been created.
Maybe this line from /var/log/foreman-installer/foreman.log helps: [DEBUG 2020-04-22T09:34:41 main] Hook /usr/share/foreman-installer/hooks/boot/10-reset_foreman_db.rb returned #<Clamp::Option::Definition:0x000000018c5130 @switches=["--reset-foreman-db"], @type=:flag, @description="Drop foreman database first? You will lose all data! Unfortunately we\ncan't detect a failure at the moment so you should verify the success\nmanually. e.g. dropping can fail when DB is currently in use.", @default_value=false, @multivalued=nil, @attribute_name="reset_foreman_db"> [DEBUG 2020-04-22T09:34:41 main] Hook /usr/share/foreman-installer/hooks/boot/11-detailed_exitcodes.rb returned #<Clamp::Option::Definition:0x000000018cbfa8 @switches=["--detailed-exitcodes"], @type=:flag, @description="Provide transaction information via exit codes, see puppet-agent(8)\nfor full details.", @default_value=false, @multivalued=nil, @attribute_name="detailed_exitcodes">
[root@puppetmaster ~]# foreman-installer
/Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Failed to call refresh: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
/Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/errors.rb:157:in `fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/exec.rb:168:in `sync'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/exec.rb:626:in `refresh'
But if I use only the command: /usr/sbin/foreman-rake db:migrate
Hello @mcorr !
Thanks for the suggestion.
i did encounter this because i wanted to “clone” a foreman/katello instance (version 2.3/3.18), to import content from the instance we daily use, and then perform upgrade.
I didn’t find such a “satellite-clone” nor such a “instance migrate” command in foreman.