Skip to content

Commit

Permalink
Issue deric#77 - attempt to fathom id automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Knarr authored and Joshua Knarr committed Nov 11, 2016
1 parent 53bba0c commit 19c8efe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/facter/hostid.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# add hostid fact
# it grabs the last digits off the hostname to automatically provision services which need
# a host to have some sort of unique serial number
#
Facter.add(:hostid) do
setcode do
hostid = Facter.value(:hostname)
hostid.gsub(/\D/, "")
end
end
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
$datalogstore = undef
$election_port = 2888
$export_tag = 'zookeeper'
$id = '1'
$id = $facts['hostid']
if $id == nil { $id = '1' }
$init_limit = 10
$initialize_datastore = false
$leader = true
Expand Down

0 comments on commit 19c8efe

Please sign in to comment.