Puppet breaks with multiple node inheritances -


puppet on tst-01 works fine when using:

node "tst-01" inherits basenode { 

but breaks when try organize servers groups configuration:

node "tst-01" inherits redhat6server { 

the error "inherits redhat6server" is:

err: not retrieve catalog; skipping run [root@tst-01 ~]# puppet agent --test err: not retrieve catalog remote server: error 400 on server: failed parse template ldap/access.conf: not find value 'netgroup' @ 124:/etc/puppet/modules/ldap/templates/access.conf @ /etc/puppet/modules/ldap/manifests/init.pp:82 on node tst-01.tst.it.test.com warning: not using cache on failed catalog err: not retrieve catalog; skipping run 

this access.conf file, works fine if inherits set "inherits basenode".

[root@puppet]# grep -v "#" /etc/puppet/modules/ldap/templates/access.conf  + : root : local + : @<%= netgroup %> : - : : [root@puppet]#  

this configuration in /etc/puppet/manifests/nodes.pp.

# basenode configuration node "basenode" {         include resolv_conf         include sshd         include ntpd         include motd }  # groups node "redhat6server" inherits basenode {         include ldap_auth }  # testservers node "tst-01" inherits redhat6server {         $netgroup = tst-01 } 

i planning bring more organisation (read: avoid configuration repetition) in nodes.pp grouping machines, e.g. rh5 , rh6 machines instead of adding multiple lines of includes rh5 , rh6 servers.

your running variable scoping problem. official documentation discusses issue.

in short, redhat6server doesn't have access netgroup variable.

the method employ work around use hiera. this, ldap_auth module can defined way, , pull value hiera configuration file (typically yaml file in /etc/puppet/hiera).

you defined ldap_auth this:

ldap_auth/manifests/init.pp:

class ldap_auth($netgroup=hiera('netgroup')) { ... } 

or if on puppet 3.x, can use automatic parameter lookup:

class ldap_auth($netgroup) { ... } 

and have yaml file with:

ldap_auth::netgroup = 'netgroup' 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -