Hello,

I have this configuration:

File: comon.yaml

SSH:
 ConfigFolder: "/etc/ssh/"
 sshd_config:
  Protocol: "1,2"
  SyslogFacility: "AUTHPRIV"
  *PermitRootLogin*: "no"
  PasswordAuthentication: "yes"
  ChallengeResponseAuthentication: "no"
  GSSAPIAuthentication: "yes"
  GSSAPICleanupCredentials: "yes"
  UsePAM: "yes"
  *ClientAliveInterval*: "100"

File test_env.yaml [same keys as in comon.yaml but with different values] :

SSH
 sshd_config:
  *PermitRootLogin*: "yes"
  *ClientAliveInterval*: "80"


File hiera.yaml:

---
:backend:
  - yaml
:hierarchy:
  - %{environment}
  - comon

:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /var/lib/hiera on *nix
# - %CommonAppData%\PuppetLabs\hiera\var on Windows
# When specifying a datadir, make sure the directory exists.
  :datadir: /etc/puppet/hieradata

In puppet code:
 $ssh_data = hiera_hash('SSH')
 $sshd_config = $ssh_data('sshd_config')


If a node has %{environment} == test_env I want to retrieve a hash 
(in sshd_config) like:

  Protocol: "1,2"
  SyslogFacility: "AUTHPRIV"
*  PermitRootLogin: "yes"*
  PasswordAuthentication: "yes"
  ChallengeResponseAuthentication: "no"
  GSSAPIAuthentication: "yes"
  GSSAPICleanupCredentials: "yes"
  UsePAM: "yes"
*  ClientAliveInterval: "80"*

if environment != test_env then I want to retrieve :

  Protocol: "1,2"
  SyslogFacility: "AUTHPRIV"
  *PermitRootLogin: "no"*
  PasswordAuthentication: "yes"
  ChallengeResponseAuthentication: "no"
  GSSAPIAuthentication: "yes"
  GSSAPICleanupCredentials: "yes"
  UsePAM: "yes"
  *ClientAliveInterval: "100"*



In my setup for the first care i get (it reads only test_env.yaml - that is 
not what I want):
  *PermitRootLogin*: "yes"
  *ClientAliveInterval*: "80"

and for the second (reads only comon.yaml - is ok) :

  Protocol: "1,2"
  SyslogFacility: "AUTHPRIV"
  *PermitRootLogin*: "no"
  PasswordAuthentication: "yes"
  ChallengeResponseAuthentication: "no"
  GSSAPIAuthentication: "yes"
  GSSAPICleanupCredentials: "yes"
  UsePAM: "yes"
  *ClientAliveInterval*: "100"

Is this possible with my Hiera definition?


Thank you,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to