Why does the Foreman Installer keeps adding some changes back to config files?

Problem:

I installed Foreman 1.20 last month, and upgraded to Foreman 1.21 last week. I occasionally re-run the Foreman Installer to reconfigure parts of Foreman. When I do this, I notice that the Installer changes things which are not at all related to what I’m doing. What’s going on here?

In the following example, I haven’t made any changes today. Why is Foreman Installer trying to add deprecated settings like locations_enabled and organizations_enabled:

root@foreman:/etc/foreman-installer/scenarios.d# foreman-installer --noop --dont-save-answers --verbose
...
...
[ WARN 2019-03-14T20:49:52 verbose]  /Stage[main]/Foreman::Config/Concat[/etc/foreman/settings.yaml]/Fil
e[/etc/foreman/settings.yaml]/content: 
[ WARN 2019-03-14T20:49:52 verbose] --- /etc/foreman/settings.yaml      2019-03-13 00:56:00.905990813 +0000
[ WARN 2019-03-14T20:49:52 verbose] +++ /tmp/puppet-file20190314-6778-fhgqy1    2019-03-14 20:49:52.920681876 +0000
[ WARN 2019-03-14T20:49:52 verbose] @@ -5,6 +5,8 @@
[ WARN 2019-03-14T20:49:52 verbose]  
[ WARN 2019-03-14T20:49:52 verbose]  :unattended: true
[ WARN 2019-03-14T20:49:52 verbose]  :require_ssl: true
[ WARN 2019-03-14T20:49:52 verbose] +:locations_enabled: false
[ WARN 2019-03-14T20:49:52 verbose] +:organizations_enabled: false
[ WARN 2019-03-14T20:49:52 verbose]  :puppetrun: false
[ WARN 2019-03-14T20:49:52 verbose] 

And also keeps trynig to add these passenger settings again and again?

[ WARN 2019-03-14T20:49:53 verbose]  /Stage[main]/Apache::Mod::Passenger/File[passenger.conf]/content: 
[ WARN 2019-03-14T20:49:53 verbose] --- /etc/apache2/mods-available/passenger.conf      2019-03-13 00:56:00.981989731 +0000
[ WARN 2019-03-14T20:49:53 verbose] +++ /tmp/puppet-file20190314-6778-rr330f    2019-03-14 20:49:53.016680467 +0000
[ WARN 2019-03-14T20:49:53 verbose] @@ -2,6 +2,13 @@
[ WARN 2019-03-14T20:49:53 verbose]  # managed by Puppet and changes will be overwritten.
[ WARN 2019-03-14T20:49:53 verbose]  <IfModule mod_passenger.c>
[ WARN 2019-03-14T20:49:53 verbose]    PassengerDefaultRuby "/usr/bin/ruby"
[ WARN 2019-03-14T20:49:53 verbose] +  PassengerMaxInstancesPerApp 6
[ WARN 2019-03-14T20:49:53 verbose] +  PassengerMaxPoolSize 12
[ WARN 2019-03-14T20:49:53 verbose] +  PassengerMaxPreloaderIdleTime 0
[ WARN 2019-03-14T20:49:53 verbose] +  PassengerMaxRequestQueueSize 250
[ WARN 2019-03-14T20:49:53 verbose] +  PassengerMaxRequests 10000
[ WARN 2019-03-14T20:49:53 verbose] +  PassengerMinInstances 1
[ WARN 2019-03-14T20:49:53 verbose]    PassengerRoot "/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini"
[ WARN 2019-03-14T20:49:53 verbose] +  PassengerStatThrottleRate 120
[ WARN 2019-03-14T20:49:53 verbose]  

Foreman and Proxy versions:

  • Ubuntu 18.04.2
  • 1.21.0

Probably it has saved the answers in the answer file which results in parameters used for the underlying puppet modules. If you run foreman-installer --full-help it will show you reset options, to reset answers to their defaults. In this case it should be something like --reset-foreman-locations-enabled and --reset-foreman-organizations-enabled.

1 Like

Running foreman-installer --reset-foreman-locations-enabled --reset-foreman-organizations-enabled fixed the first issue, and I’ll hunt down the --reset-* options to fix the Passenger and similar issues.

root@foreman:/etc/foreman-installer/scenarios.d# git diff
diff --git a/scenarios.d/foreman-answers.yaml b/scenarios.d/foreman-answers.yaml
index 27d7834..19e4550 100644
--- a/scenarios.d/foreman-answers.yaml
+++ b/scenarios.d/foreman-answers.yaml
@@ -40,8 +40,8 @@ foreman:
   user_groups:
   - puppet
   rails_env: production
-  locations_enabled: false
-  organizations_enabled: false
+  locations_enabled: 
+  organizations_enabled: 

Side note, I was not aware of the --reset-* options, and it’s not mentioned in the Foreman docs. Is it more intended to be a developer tool?

I’ve actually been looking for a way to disable certain options, such as foreman-proxy-dns-zone which cannot be a blank value. Looks like --reset-foreman-proxy-dns-zone is exactly what I need.

No, it’s not. Recently I’ve become aware that this is too well hidden for users. I’m not sure how we should advertise this. If we add a --reset line for every argument it can be very long, but if users don’t know the option exists it’s not a very useful feature.

The 20190111180118_delete_removed_settings.rb migration should have fixed this. Can you verify this is ran? From the top of my head it should be in /etc/foreman-installer/foreman.migrations/.applied.

If I understand this file correctly, it was applied on March 7:

root@foreman:~# ll  /etc/foreman-installer/scenarios.d/foreman-migrations-applied
-rw-r--r-- 1 root root 1715 Mar  7 00:10 /etc/foreman-installer/scenarios.d/foreman-migrations-applied
root@foreman:~# grep 20190111180118_delete_removed_settings.rb /etc/foreman-installer/scenarios.d/foreman-migrations-applied 
- 20190111180118_delete_removed_settings.rb
root@foreman:~#