After initial setup cannot sign in to Foreman web console with admin account

foremanpuppetpuppet-foremanpuppetmasterrubygems

Edited post to show how I installed foreman

I'm new to ruby and I am trying to install Foreman on CentOS 7.

I followed the install guide for my distro to do this:

  1. sudo yum -y install epel-release
  2. sudo rpm -ivh
    http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
  3. sudo yum -y install
    http://yum.theforeman.org/releases/1.9/el7/x86_64/foreman-release.rpm
  4. sudo yum install foreman-installer
  5. sudo foreman-installer
  6. puppet agent –test

Here are the foreman packages it installed:

sudo rpm -qa foreman*
foreman-release-1.9.3-1.el7.noarch
foreman-postgresql-1.9.3-1.el7.noarch
foreman-1.9.3-1.el7.noarch
foreman-installer-1.9.3-1.el7.noarch
foreman-debug-1.9.3-1.el7.noarch
foreman-selinux-1.9.3-1.el7.noarch
foreman-release-scl-1-1.el7.x86_64
foreman-proxy-1.9.3-1.el7.noarch
foreman-cli-1.9.3-1.el7.noarch

I set it up but cannot login with the default admin and password "changeme".

I attempted to reset the password, but got this error:

sudo foreman-rake password=123456
rake aborted!
Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (Could not find sq...

Running gem install activerecord-sqlite3-adapter gives me another error:

gem install activerecord-sqlite3-adapter
ERROR:  Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any repository

Google told me this seems to be a version mismatch and a possible solution is to put this in my Gemfile:

gem 'sqlite3'

and run

bundle install

Where is the foreman gem file located?

I got some stuff under a folder named "rh" in opt:

sudo find -name Gemfile
./rh/ruby193/root/usr/share/gems/gems/deep_cloneable-2.0.2/Gemfile
./rh/ruby193/root/usr/share/gems/gems/oauth-0.4.7/Gemfile
./rh/ruby193/root/usr/share/gems/gems/mail-2.4.4/Gemfile
./rh/ruby193/root/usr/share/gems/gems/bundler-1.3.5/lib/bundler/templates/Gemfile
./rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/generators/rails/app/templates/Gemfile
./rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/generators/rails/plugin_new/templates/Gemfile

Edit:

I installed foreman-sqlite and was able to run foreman-rake

sudo foreman-rake password=123456

/opt/rh/ruby193/root/usr/bin/ruby -I"lib:test" -I"/opt/rh/ruby193/root/usr/share/gems/gems/rake-0.9.2.2/lib" "/opt/rh/ruby193/root/usr/share/gems/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/lib/**/*_test.rb"

But when I try to sign on as admin with password 123456 it still says "Incorrect username or password".

Best Answer

It would be useful to know how you installed Foreman, but I'm going to guess that you've done a yum install foreman and haven't used the installer. I'll just note that the installer is recommended as it will set up PostgreSQL, Passenger, a Puppet master, smart proxy etc. automatically.

You will need to choose and set up a database first - PostgreSQL, MySQL or SQLite, then configure /etc/foreman/database.yml to point to it. SQLite doesn't need any extra configuration, that's the default you're seeing.

Next, yum install either foreman-sqlite, foreman-postgresql or foreman-mysql2 as appropriate. This will fix the adapter error. I strongly recommend against running gem or bundle commands on a package installation as you'll create a mix of unpackaged and packaged dependencies.

Once the DB's configured and the adapter installed, run foreman-rake db:migrate and foreman-rake db:seed to set up the contents. The db:seed command will print a random password (default is not changeme any more).

If you don't get or lose the password from db:seed, run foreman-rake permissions:reset to regenerate one.

Related Topic