This works, but I'm not sure it's the best way about going about it. I'm trying 
to define host groups in my site.pp file in such a way that when puppet runs on 
my nodes, they "know" their functional role and are configured accordingly. My 
site.pp;

    node base {

        class { 'dirsvc': }
        class { 'ntp': }
        class { 'yum': }
    }


    # workstations
    node 'inky.example.com', 'blinky.example.com' inherits base {
        $hostclass = "workstation"
        class { 'root': }
    }

    # server
    node 'pinky.example.com' inherits base {
        $hostclass = "server"
        class { 'root': }
    }

    # server
    node 'clyde.example.com' inherits base {
        $hostclass = "server"
        class { 'root': }
    }


Example of a manifest using the $hostclass variable;


    class root {

        if $hostclass == "server" {
            $rootpass = '$6$tTZjKZGj$undthG0kn5.5Fs/'
        }
        else {
            $rootpass = '$6$6R8/bcDf$Ta5Uxl7eZlH.MP/'
        }

        user { "root":
            ensure      =>  present,
            password    =>  $rootpass,
        }

        notify { "my_hostclass":
            message     =>  "Hostclass: $hostclass",
        }

    }


-- 
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