I was hoping to get info on a best practise or potentially an aim for a 
best practise that puppet development is working towards.

I would like to group our servers so that I can use the files server to 
hand out files in a hierarchal order starting with hostname, groupname, 
default file. I would also like to set the groupname in node.pp.  So far I 
have tried this using custom facts but it does not seem to be consistent. 
 I have read some posts for people trying to use mcollective but at this 
point I am not using it.  What I want to try next is to build the 
puppetgroup.rb file under /usr/lib64/ruby/site_ruby/1.8/facter/ that sets 
the fact but my thinking is I will be setting the fact during the first run 
and hence the fact I need to control config files is not loaded and the 
default config will be loaded and I will have to wait till the second 
puppet run (in some cases this could break a server's function), for the 
new fact to be used.

Some examples to show how I am implemented

node.pp
**snip**
node 'puppetclient2' inherits default {
        $group="deb"                     #set group for this server
        include puppetgroup           #setup fact for this server
        include nginx_conf             #apply an nginx.conf file to server, 
I use this method for iptables, sysctl.conf and etc_hosts
}
****

class puppetgroup.pp   #the sourcing of the new environment variable is 
inconsistent...sometimes it works and sometimes it doesn't,
******
class puppetgroup {
   Exec { path => 
"/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
 
}
        file {"/etc/profile.d/puppetgroup.sh":
        owner => root,
        group => root,
        mode  => 755,
        content => "export FACTER_puppetgroup=\"$group\"",

   }
   exec { "source puppetgroup": 
    subscribe   => File["/etc/profile.d/puppetgroup.sh"], 
    refreshonly => true, 
    command     => "bash -c 'source /etc/profile'", 
 } 
}
************

class nginx_conf  # Applying an nginx.conf depending on machine.
*****class nginx_conf {
file { "/opt/nginx/conf/nginx.conf":
            source   => [
                "puppet:///files/classes/nginx/nginx_conf.$hostname",
                "puppet:///files/classes/nginx/nginx_conf.$puppetgroup",
                "puppet:///files/classes/nginx/nginx_conf"
                ],
            mode     => "644",
            checksum => md5,
            replace => "yes",
            ensure  => "present",

    }
}
*******

Any thoughts on how to make this approach consistently happen?  Or a new 
approach that can do the same?  Can a force a reload of the facts at the 
end of running the puppetgroup.pp class?

Many thanks for any help.

Andre









-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/YJbLelrW8RMJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to