Getting the last of site specific data out of manifest

16 views
Skip to first unread message

Kenton Brede

unread,
Oct 16, 2014, 3:33:40 PM10/16/14
to puppet...@googlegroups.com
I'm using OS Puppet 3.7.1.  I'm using Hiera and *mostly* have our site specific data out of our modules.

I could use some advice on how to handle the following two cases.

Case #1

node basenode {
  include files   # files common to all nodes
}

node 'hostname.example.com' inherits basenode {
  include files::hostname  # files specific to host
}

Case #2

In template files, flow control like:

<% if (hostname == "hostname1") -%>
X11Forwarding yes
<% else -%>
X11Forwarding no
<% end -%>

Any advice appreciated.

Thanks,

--
Kent Brede




Felix Frank

unread,
Nov 5, 2014, 4:23:02 PM11/5/14
to puppet...@googlegroups.com
On 10/16/2014 09:33 PM, Kenton Brede wrote:
I'm using OS Puppet 3.7.1.  I'm using Hiera and *mostly* have our site specific data out of our modules.

I could use some advice on how to handle the following two cases.

Case #1

node basenode {
  include files   # files common to all nodes
}

node 'hostname.example.com' inherits basenode {
  include files::hostname  # files specific to host
}


node basenode {
    hiera_include('classes')
}

Your hierarchy should have

classes: files

on a common level and

classes: files::%{hostname}

on a level where it only applies to such nodes that have such a class. This might well be the node specific level (i.e., the top of your hierarchy).


Case #2

In template files, flow control like:

<% if (hostname == "hostname1") -%>
X11Forwarding yes
<% else -%>
X11Forwarding no
<% end -%>



X11Forwarding <%= scope.function_hiera('ssh::x11_forwarding', 'no') %>

Set this Hiera key to 'yes' for each node that should get it.

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages