Skip to content

Commit

Permalink
Merge pull request #11 from miklinux/minor_fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
thias authored Jan 30, 2025
2 parents b9b0779 + 20fdce8 commit f03c0ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
24 changes: 18 additions & 6 deletions lib/facter/puppetmaster.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# Create custom "puppetmaster" boolean fact

if ["/etc/puppet/puppetmaster.conf", "/etc/puppetlabs/puppet/puppetmaster.conf"].map { |x| File.exist? x }.any?
Facter.add("puppet_puppetmaster") do
setcode do
"true"
end
binaries = [
'/opt/puppetlabs/bin/puppetserver',
'/bin/puppetserver',
'/usr/bin/puppetserver',
'/usr/sbin/puppetserver',
'/usr/local/bin/puppetserver',
'/usr/local/sbin/puppetserver',
]

binaries.each do |filename|
if File.exists?(filename)
Facter.add('puppet_puppetmaster') { setcode { true } }
Facter.add('puppet_puppetmaster_version') do
setcode do
version = Facter::Util::Resolution.exec("#{filename} --version 2>/dev/null")
version.match(%r{\d+\.\d+\.\d+})[0] if version
end
end
end
end

4 changes: 3 additions & 1 deletion manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@
# service is run when it shouldn't have been (we respect noop here).
if $master {
$agentconfname = "${confdir}/puppetagent.conf"
$agentconfmode = '0644'
File[$agentconfname] ~> Exec['catpuppetconf']
} else {
$agentconfname = "${confdir}/puppet.conf"
$agentconfmode = '0640'
}
file { $agentconfname:
owner => 'root',
group => 'root',
mode => '0640',
mode => $agentconfmode,
content => template('puppet/puppetagent.conf.erb'),
}

Expand Down

0 comments on commit f03c0ff

Please sign in to comment.