-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add service to publish facts to foreman #52
base: master
Are you sure you want to change the base?
Conversation
a81c7aa
to
b09dae2
Compare
bb208a1
to
8860920
Compare
3bcf370
to
d2c4065
Compare
Puppet also has the Fact indirector concept and here's an example: https://github.com/puppetlabs/puppetlabs-satellite_pe_tools/blob/main/lib/puppet/indirector/facts/satellite.rb |
I would prefer to avoid the indirector. As far as I know puppet does not really support multiple of them, and Mos people already use the functionality to store data in Puppetdb. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know puppet does not really support multiple of them
It really does not. There is just 1 fact indirector.
I'm sure this change will play really nice with https://github.com/puppetlabs/puppetlabs-satellite_pe_tools, but I don't care too much about that.
Overall I'd prefer to use the system Ruby because dependencies are easier to manage. Not that we have many, but still.
templates/fact_watcher.service.epp
Outdated
|
||
[Service] | ||
Type=simple | ||
Environment=PATH=/opt/puppetlabs/puppet/bin:<%= $facts['path'] %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this path needed? I think you end up using the AIO Puppet's Ruby so then why do you need rb-notify
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rb-notify
is installed into the puppet ruby. And that's the only ruby interpreter we know is present on the system. Managing system ruby is a whole different can of worms.
989c875
to
d17f301
Compare
I think that's more complicated because we don't know if a system ruby exists. And the whole service is an edge case for PE users to make the migration easier. So I would argue this is fine. |
We pull in |
} | ||
package { 'ruby-inotify': | ||
ensure => 'installed', | ||
provider => 'puppet_gem', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike using the puppet_gem
provider (or really, gem
on production servers). If you upgrade your Puppet AIO it may break the native extensions and you don't know what you're pulling in.
'Environment' => "PATH=/opt/puppetlabs/puppet/bin:${facts['path']}", | ||
'User' => $puppet_user, | ||
'ExecStart' => "${puppet_etcdir}/node.rb --watch-facts --push-facts-parallel", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to enforce the AIO Ruby (and I really dislike it), perhaps this is better?
'Environment' => "PATH=/opt/puppetlabs/puppet/bin:${facts['path']}", | |
'User' => $puppet_user, | |
'ExecStart' => "${puppet_etcdir}/node.rb --watch-facts --push-facts-parallel", | |
'User' => $puppet_user, | |
'ExecStart' => "/opt/puppetlabs/puppet/bin/ruby ${puppet_etcdir}/node.rb --watch-facts --push-facts-parallel", |
@@ -40,6 +40,10 @@ | |||
# The directory used to install the report processor to | |||
# @param use_client_tls_certs | |||
# Enable client TLS authentication to foreman | |||
# @param fact_watcher_service | |||
# Sets up a simple systemd unit that watches for new fact files and publishes them to foreman. Not required when foreman is the ENC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a $enc
parameter which you can use. Perhaps fail()
if both are true?
Technically you could look at $enc_upload_facts
but then you don't have a guarantee that the facts are uploaded before the ENC is calculated. Uploading facts will create a host entry when it doesn't exist, so I wouldn't do that.
# @param fact_watcher_service | ||
# Sets up a simple systemd unit that watches for new fact files and publishes them to foreman. Not required when foreman is the ENC | ||
# @param manage_fact_watcher_dependencies | ||
# Install the missing dependencies for fact_watchter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Install the missing dependencies for fact_watchter | |
# Install the missing dependencies for fact_watcher |
If foreman-proxy is installed, yes. I doubt that someone wants to submit facts but not run foreman-proxy, but who knows. If you want, I can update it to the gem provider. |
No description provided.