Compare commits
1 Commits
develop
...
benvin/hie
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b60a31cc9 |
@ -4,6 +4,8 @@ defaults:
|
|||||||
datadir: "hieradata"
|
datadir: "hieradata"
|
||||||
data_hash: "yaml_data"
|
data_hash: "yaml_data"
|
||||||
hierarchy:
|
hierarchy:
|
||||||
|
- name: Custom Hiera Plugin
|
||||||
|
data_hash: custom_hiera_plugin::data_hash
|
||||||
- name: Consolidated Data
|
- name: Consolidated Data
|
||||||
paths:
|
paths:
|
||||||
- "nodes/%{trusted.certname}.yaml"
|
- "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
|
# this is the base class, which will be used by all servers
|
||||||
class profiles::base () {
|
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
|
# run a limited set of classes on the first run aimed at bootstrapping the new node
|
||||||
if $facts['firstrun'] {
|
if $facts['firstrun'] {
|
||||||
include profiles::firstrun::init
|
include profiles::firstrun::init
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user