Foreman-installer 1.16 - new user - where does the default configuration come from?

Hi all,

I’m am new to Foreman, and I have tried to look and find the answer to my question and haven’t been able to find it so I am asking here. Thanks in advance for any direction.

After I have installed Foreman 1.16 and it is up and running and I login I can see things like:
Hosts -> “Installation Media” “CentOs mirror”. I didn’t create this, it came with the install.
How was it added to Foreman?

Same with:
Hosts -> “Partition Tables” “Kickstart Default” this was part of the install.
Hosts -> “Provisioning Templates” “Kickstart RHEL Default” this was part of the install.

How would I modify or add my own entry on install?

What if I didn’t want any of them? Is there a way not to have them be there on install?

After it is up you can just use the GUI or API. Are the defaults added using the API?

I am using yum -y install foreman-installer and then running the foreman-installer command.

Thanks!
Jerry

Hey, welcome to the community! Hope we can help you get comfortable with Foreman :smile:

We do indeed add a bunch of things to the initial database by default, as most people want to be up-and-running as quick as possible (this cuts down on those “paper cuts” that tend to make people quit before they’ve even got it working :slight_smile:). All the things you’ve mentioned are part of this initial seeding, but it’s actually done directly in Rails rather than via the API (and also consider checking out Hammer, our CLI tool).

There’s no way to disable the initial seeding of data, as far as I know (some of it is necessary for Foreman to function at all, like creating the initial admin login), but once the install is done you’re welcome to modify/delete the entries, or create entirely new ones if you wish. This can be done via the GUI or the API, whichever suits you better.

Ultimately, it’s your instance, after all - if you’re (say) only going to be a Debian shop then deleting all the RHEL/Centos stuff makes perfect sense. We just provide some defaults to get people going, and obviously we can’t predict which of the many OSes we support they’ll want to work with.

If you need any more guidance on specifics of those steps, or want to go into a little more detail on your goals, feel free to shout out.

Great! I wasn’t sure what to call it.
Does the “initial seeding of data” exist is some rpm or is like a script that is part of installing an rpm? I would like to look at the code that does the seeding of data. I know I have changed the initial username and password with a command line argument on the install. Where is the Rails code?

Thanks!

I think the code starts here: https://github.com/theforeman/foreman/tree/1.16-stable I am not sure the path below it to find the Rails code?

Thanks!

I did find this:

find . -type f -exec grep -l “CentOS mirror” {} ;

./foreman/CHANGELOG
./foreman/db/migrate/20171121082256_update_centos_installation_media.rb
./foreman/db/seeds.d/100-installation_media.rb

and this:

find . -type f -exec grep -l “Kickstart default” {} ;

./foreman/app/views/unattended/partition_tables_templates/kickstart_default.erb
./foreman/db/migrate/20131127112625_rename_seeded_templates.rb
./foreman/db/migrate/20141203082104_make_templates_default.rb
./foreman/db/seeds.d/020-partition_tables_list.rb
./foreman/db/seeds.d/020-provisioning_templates_list.rb

I am not sure where those are in the rpm?

Thanks!

While I’m happy to go into the details, my instinct is telling me you have a specific end goal in mind (hacking on the RPMs directly isn’t a common request :stuck_out_tongue:).

Perhaps you could share a bit about what you’re trying to achieve? There may be an easier way to get there that we can figure out together…

The rpm will install this by default but you might be able to use
foreman-rake and drop the database and reseed it with your own data
without the stuff you don’t want.
Have a look at what foreman-rake might be able to do for you.

Regards,

Joop

That sounds very similar to grep -r "CentOS mirror"

In short: there is a seeds.d directory with all the seeds, but they’re considered internal and not something you modify yourself.

A better solution, at least for the provisioning templates, is the templates plugin. It can sync from a git repository. All our templates are in https://github.com/theforeman/community-templates and we update the built in ones before we release a new minor (1.x) version.

For mirrors I’d advise writing your own script using the API or hammer if you want to do updates after installation.

I am trying to learn how it all works together and how to quickly stand up Foreman so that is has everything ready to go to start installing servers. I think having all the content that comes with it is good when you are trying to use the tool at first, but it also tends to get in the way in some cases.

I have no intention of hacking the rpm file. I did think about modifying the files once they are installed. I don’t see a reason to do that now.

Others have responded with foreman-rake and the templates plugin which seems like the direction I should head.

Thank you all for your suggestions!

I have a bunch more things to read about now. :slight_smile:

An excellent goal :slight_smile: - but if that’s all, I’d strongly avoid using foreman-rake to drop the DB. As I said, some of those seeds are required for proper operation, and trying to mess with them or partially seed the DB may lead to unintended consequences. Using the API or GUI, and plugins like foreman-templates, is definitely the way to go.

Do jump back in once you’ve got more questions :slight_smile:

I ran:
foreman-rake templates:export repo=/tmp/template
And I get partition_tables_templates provisioning_templates
Is there a way to get things like Subnets and Domains and Installation Media and Operating Systems?

Thanks!

No, the Templates plugin does indeed only handle templates :slight_smile:

For more general scripting/automation of changes, I’d suggest looking at Hammer, our CLI tool.