chore: testing a simple data_hash hiera plugin
testing testing ....
This commit is contained in:
parent
0aec795aec
commit
0b60a31cc9
@ -4,6 +4,8 @@ defaults:
|
||||
datadir: "hieradata"
|
||||
data_hash: "yaml_data"
|
||||
hierarchy:
|
||||
- name: Custom Hiera Plugin
|
||||
data_hash: custom_hiera_plugin::data_hash
|
||||
- name: Consolidated Data
|
||||
paths:
|
||||
- "nodes/%{trusted.certname}.yaml"
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'socket'
|
||||
|
||||
# Custom Hiera Plugin
|
||||
# This plugin returns static data for testing purposes
|
||||
Puppet::Functions.create_function(:'custom_hiera_plugin::data_hash') do
|
||||
# :reek:UtilityFunction
|
||||
def data_hash(_options, _context)
|
||||
# Return a simple hash with the required key-value pairs
|
||||
{
|
||||
'custom_hiera_plugin::var1' => 'foo',
|
||||
'custom_hiera_plugin::hostname' => Socket.gethostname
|
||||
}
|
||||
end
|
||||
end
|
||||
@ -1,6 +1,15 @@
|
||||
# this is the base class, which will be used by all servers
|
||||
class profiles::base () {
|
||||
|
||||
# Test custom hiera plugin
|
||||
notify { 'custom_hiera_plugin_test':
|
||||
message => "Custom hiera plugin value: ${lookup('custom_hiera_plugin::var1')}",
|
||||
}
|
||||
|
||||
notify { 'custom_hiera_plugin_hostname':
|
||||
message => "Custom hiera plugin hostname: ${lookup('custom_hiera_plugin::hostname')}",
|
||||
}
|
||||
|
||||
# run a limited set of classes on the first run aimed at bootstrapping the new node
|
||||
if $facts['firstrun'] {
|
||||
include profiles::firstrun::init
|
||||
|
||||
Loading…
Reference in New Issue
Block a user