----- Original Message -----
> From: "Denny Schierz" <[email protected]>
> To: "puppet-users" <[email protected]>
> Sent: Monday, February 15, 2016 2:33:47 PM
> Subject: Re: [Puppet Users] Syntax problem, if/case in class section for 
> $hostname

> hi,
> 
> in the last 5 min I was able to solve my problem. The problem was that I
> wanted to override a parameterized class .. my solution is is now:
> 
> class users::fbar::params {
> 
> if ($::hostname =~ /^devpc21+(\d+)./) {
>      $groups      = [ 'admin' ] }
> else {
> 
>      $groups      = [ 'devel' ] }
> }
> 
> class users::fbar (
>      $ensure      = present,
>      $groups      = $users::fbar::params::groups
> )
>      inherits  users::fbar::params
> 
> {
>   case $ensure {
> 
>      present: {
>         users::add_user { fbar:
>            comment                    => 'Foo Bar',
>            uid                     => 1024,
>            groups                  => $groups,
>            shell                   => '/bin/bash',
>            yubikeyid               => 'cccccxxxxxx',
>            require                 => Group[ $groups ],
>         }
>      }
>      absent: {
>         users::del_user { ['fbar' ]:
>            managehome  => true,
>         }
> 
>      }
>   }
> }
> 
> It seems to be impossible to use if/case/whatever as selector for a
> parameter.

Puppet has selectors for this purpose.

https://docs.puppetlabs.com/puppet/latest/reference/lang_conditional.html#selectors

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/871116132.285727.1455543495753.JavaMail.zimbra%40devco.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to