Hello puppeteers,
I''d to set passwd and shadow in my nsswitch.conf based on whether a
server uses passwd authentication or ldap authentication. My first
effort failed when I tried to set a variable in each node, i.e.,
node "haha.papa.com" {
$adgroup = "yes"
}
then:
class nsswitch {
$passwd = $adgroup ? {
"yes" => "files ldap",
"no" => "files",
default => "files",
}
[...]
Well that didn''t work. "files" is assigned to $passwd every
time.
So then I created a class adgoup and included it in the node:
node "haha.papa.com" {
include adgroup
}
Then I tried to assign passwd this way:
$passwd = defined(Class[adgroup]) ? {
"yes" => "files ldap",
"no" => "files",
default => "files",
}
Well, that didn''t work either. It assigns "files" to $passwd
every
time.
Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi Jeff,
I use constructs like that all the time - so it should work.
The only difference to mine is that I don''t use quotation marks for
values:
class nsswitch {
$passwd = $adgroup ? {
- "yes" => "files ldap",
- "no" => "files",
+ yes => "files ldap",
+ no => "files",
default => "files",
}
please try it this way.
Phillip
Jeff schrieb:> Hello puppeteers,
>
> I''d to set passwd and shadow in my nsswitch.conf based on whether
a
> server uses passwd authentication or ldap authentication. My first
> effort failed when I tried to set a variable in each node, i.e.,
>
> node "haha.papa.com" {
> $adgroup = "yes"
> }
>
> then:
>
> class nsswitch {
> $passwd = $adgroup ? {
> "yes" => "files ldap",
> "no" => "files",
> default => "files",
> }
>
> [...]
>
> Well that didn''t work. "files" is assigned to $passwd
every time.
>
> So then I created a class adgoup and included it in the node:
>
> node "haha.papa.com" {
> include adgroup
> }
>
> Then I tried to assign passwd this way:
>
> $passwd = defined(Class[adgroup]) ? {
> "yes" => "files ldap",
> "no" => "files",
> default => "files",
> }
>
> Well, that didn''t work either. It assigns "files" to
$passwd every
> time.
>
> Any thoughts?
>
>
>
>
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com
> To unsubscribe from this group, send email to
puppet-users-unsubscribe@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
--
Phillip Scholz
Junior Linux System-Administrator
IT Shared Hosting Linux - SaaS, Karlsruhe
1&1 Internet AG
Brauerstraße 48
D-76135 Karlsruhe
Tel. +49-721-91374-4818
phillip.scholz@1und1.de
http://www.1und1.de/
Amtsgericht Montabaur HRB 6484
Vorstand: Henning Ahlert, Ralph Dommermuth,
Matthias Ehrlich, Andreas Gauger,
Thomas Gottschlich, Matthias Greve,
Robert Hoffmann, Markus Huhn,
Achim Weiss
Aufsichtsratsvorsitzender: Michael Scheeren
On May 19, 3:44 am, Phillip Scholz <phillip.sch...@1und1.de> wrote:> Hi Jeff, > > I use constructs like that all the time - so it should work. > The only difference to mine is that I don''t use quotation marks for values: > > class nsswitch { > $passwd = $adgroup ? { > - "yes" => "files ldap", > - "no" => "files", > + yes => "files ldap", > + no => "files", > default => "files", > } > > please try it this way. > > Phillip >Hi Phillip. I tried that and it didn''t work. Here''s my nsswitch class: class nsswitch { $passwd = $adgroup ? { yes => "files ldap", no => "files", default => "files", } $shadow = $adgroup ? { yes => "files ldap", no => "files", default => "files", } file { "/etc/nsswitch.conf": path => "/etc/nsswitch.conf", mode => 0644, owner => root, group => root, content => template("/var/puppet/modules/nsswitch/files/ nsswitch.conf.erb") } } And here''s my node: node ''sam.joedog.org'' inherits basenode { include ssh include harden::linux $adgroup = "yes" } The nsswitch.conf file is built with the default strings. Is there a way I can see the value of adgroup? Cheers, Jeff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
I use the notify resource (http://reductivelabs.com/trac/puppet/wiki/
TypeReference#id163):
$adgroup = "yes"
notify { "adgroup" : message => "adgroup: $adgroup" }
This will appear in the output when you run
puppetd --test
on a client, which is where I find I use it the most (debugging &
testing).
Robb
On May 19, 5:33 am, Jeff <joesi...@gmail.com>
wrote:> On May 19, 3:44 am, Phillip <phillip.sch...@1und1.de> wrote:
>
>
>
> > Hi Jeff,
>
> > I use constructs like that all the time - so it should work.
> > The only difference to mine is that I don''t use quotation
marks for values:
>
> > class nsswitch {
> > $passwd = $adgroup ? {
> > - "yes" => "files ldap",
> > - "no" => "files",
> > + yes => "files ldap",
> > + no => "files",
> > default => "files",
> > }
>
> > please try it this way.
>
> > Phillip
>
> Hi Phillip.
>
> I tried that and it didn''t work. Here''s my nsswitch
class:
>
> class nsswitch {
> $passwd = $adgroup ? {
> yes => "files ldap",
> no => "files",
> default => "files",
> }
> $shadow = $adgroup ? {
> yes => "files ldap",
> no => "files",
> default => "files",
> }
> file { "/etc/nsswitch.conf":
> path => "/etc/nsswitch.conf",
> mode => 0644,
> owner => root,
> group => root,
> content => template("/var/puppet/modules/nsswitch/files/
> nsswitch.conf.erb")
> }
>
> }
>
> And here''s my node:
>
> node ''sam.joedog.org'' inherits basenode {
> include ssh
> include harden::linux
> $adgroup = "yes"
>
> }
>
> The nsswitch.conf file is built with the default strings. Is there a
> way I can see the value of adgroup?
>
> Cheers,
> Jeff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Robb wrote:> I use the notify resource (http://reductivelabs.com/trac/puppet/wiki/ > TypeReference#id163): > > $adgroup = "yes" > notify { "adgroup" : message => "adgroup: $adgroup" } > > > This will appear in the output when you run > puppetd --test > on a client, which is where I find I use it the most (debugging & > testing). > > Robb > > On May 19, 5:33 am, Jeff <joesi...@gmail.com> wrote: >Hi, I was looking at the node definition and noted that you specified the $adgroup variable AFTER you included the classes - I''m not sure if there is some kind of lexical funny node scope stuff going on, but the easiest way to test that a variable is passing correctly is use a notify resource like Robb says or use a notice() function call in the relevant included class. The benefit to using a dummy notify resource is that you''ll see it on the client (unlike the notice() function, which is server only) Regards, AJ>> On May 19, 3:44 am, Phillip <phillip.sch...@1und1.de> wrote: >> >> >> >> >>> Hi Jeff, >>> >>> I use constructs like that all the time - so it should work. >>> The only difference to mine is that I don''t use quotation marks for values: >>> >>> class nsswitch { >>> $passwd = $adgroup ? { >>> - "yes" => "files ldap", >>> - "no" => "files", >>> + yes => "files ldap", >>> + no => "files", >>> default => "files", >>> } >>> >>> please try it this way. >>> >>> Phillip >>> >> Hi Phillip. >> >> I tried that and it didn''t work. Here''s my nsswitch class: >> >> class nsswitch { >> $passwd = $adgroup ? { >> yes => "files ldap", >> no => "files", >> default => "files", >> } >> $shadow = $adgroup ? { >> yes => "files ldap", >> no => "files", >> default => "files", >> } >> file { "/etc/nsswitch.conf": >> path => "/etc/nsswitch.conf", >> mode => 0644, >> owner => root, >> group => root, >> content => template("/var/puppet/modules/nsswitch/files/ >> nsswitch.conf.erb") >> } >> >> } >> >> And here''s my node: >> >> node ''sam.joedog.org'' inherits basenode { >> include ssh >> include harden::linux >> $adgroup = "yes" >> >> } >> >> The nsswitch.conf file is built with the default strings. Is there a >> way I can see the value of adgroup? >> >> Cheers, >> Jeff >> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Mmm that''s interesting. Where is this syntax "$var = $value ?
{}"
syntax documented? Can''t find it in the LanguageTutorial.
Thanks in advance,
--
Jean-Baptiste Quenot
http://jbq.caraldi.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi> Mmm that''s interesting. Where is this syntax "$var = $value ? {}" > syntax documented? Can''t find it in the LanguageTutorial.http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#selectors greets Pete --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On May 19, 7:44 pm, AJ <a...@junglist.gen.nz> wrote:> Robb wrote: > > I use the notify resource (http://reductivelabs.com/trac/puppet/wiki/ > > TypeReference#id163): > > > $adgroup = "yes" > > notify { "adgroup" : message => "adgroup: $adgroup" } > > > This will appear in the output when you run > > puppetd --test > > on a client, which is where I find I use it the most (debugging & > > testing). > > > Robb >Thanks. That enabled me to streamline testing. Here''s the problem. The node inherited basenode and basenode included nsswitch. I''m not sure how to organize this. Every server has an nsswitch.conf but only some servers have a special nsswitch.conf. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---