Trying to ascertain if a particular client has been assigned the class ldap::server_install because I want to have a different configuration value for the ldap::configure files This just gives me a syntax error... Class["ldap::server_install"].included? ? $is_ldap_server = true : $is_ldap_server = false Is there a way that I can derive whether a class has been assigned to the client or do I have to write a custom fact? -- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white@ttiltd.com 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com Need help communicating between generations at work to achieve your desired success? Let us help! -- 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 Thu, Jul 28, 2011 at 1:48 PM, Craig White <craig.white@ttiltd.com> wrote:> Trying to ascertain if a particular client has been assigned the class ldap::server_install because I want to have a different configuration value for the ldap::configure files > > This just gives me a syntax error... > > Class["ldap::server_install"].included? ? $is_ldap_server = true : $is_ldap_server = false > > Is there a way that I can derive whether a class has been assigned to the client or do I have to write a custom fact?Presumably, you have already made a decision somewhere in you manifest to include class ldap::server_install, so why not set a variable there? I assume you want the correct config in one run, rather than waiting for ldap to be deployed before a custom fact updates. Thanks, Nan -- 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 Jul 28, 2011, at 11:39 AM, Nan Liu wrote:> On Thu, Jul 28, 2011 at 1:48 PM, Craig White <craig.white@ttiltd.com> wrote: >> Trying to ascertain if a particular client has been assigned the class ldap::server_install because I want to have a different configuration value for the ldap::configure files >> >> This just gives me a syntax error... >> >> Class["ldap::server_install"].included? ? $is_ldap_server = true : $is_ldap_server = false >> >> Is there a way that I can derive whether a class has been assigned to the client or do I have to write a custom fact? > > Presumably, you have already made a decision somewhere in you manifest > to include class ldap::server_install, so why not set a variable > there? I assume you want the correct config in one run, rather than > waiting for ldap to be deployed before a custom fact updates. > > Thanks,---- actually, it''s likely to be already deployed (ldap::client_install & ldap::configure) as those are somewhat of a base functionality. My intent is to ensure that if the client is actually an LDAP server, that it attempts to connect to itself first, rather than another server over the wire. So yes, it would be better to get it right on the first run but given an array of available ldap servers to connect to, it''s possible that a manually typed and erroneous variable could go unnoticed. Also, this seems to be something that is knowable anyway and probably not too difficult to write a custom fact that perhaps will take 2 puppet runs to fix. It just seemed to me that there must be some way to derive what is installed on the client within a manifest but I couldn''t find any suggestions on Google or PuppetLabs site so I asked. Thanks Craig -- 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.
It looks like you''re wanting to do it via erb, but if you can perform whatever logic in the manifest, you can use tagged: (scott@cornstarch:tmp)% cat foo.pp class foo { } class bar { if (tagged("foo")) { notice("You''re including foo") } } include foo, bar (scott@cornstarch:tmp)% puppet foo.pp notice: Scope(Class[Bar]): You''re including foo notice: Finished catalog run in 0.01 seconds (scott@cornstarch:tmp)% -scott On Thu, Jul 28, 2011 at 12:42 PM, Craig White <craig.white@ttiltd.com>wrote:> > On Jul 28, 2011, at 11:39 AM, Nan Liu wrote: > > > On Thu, Jul 28, 2011 at 1:48 PM, Craig White <craig.white@ttiltd.com> > wrote: > >> Trying to ascertain if a particular client has been assigned the class > ldap::server_install because I want to have a different configuration value > for the ldap::configure files > >> > >> This just gives me a syntax error... > >> > >> Class["ldap::server_install"].included? ? $is_ldap_server = true : > $is_ldap_server = false > >> > >> Is there a way that I can derive whether a class has been assigned to > the client or do I have to write a custom fact? > > > > Presumably, you have already made a decision somewhere in you manifest > > to include class ldap::server_install, so why not set a variable > > there? I assume you want the correct config in one run, rather than > > waiting for ldap to be deployed before a custom fact updates. > > > > Thanks, > ---- > actually, it''s likely to be already deployed (ldap::client_install & > ldap::configure) as those are somewhat of a base functionality. My intent is > to ensure that if the client is actually an LDAP server, that it attempts to > connect to itself first, rather than another server over the wire. > > So yes, it would be better to get it right on the first run but given an > array of available ldap servers to connect to, it''s possible that a manually > typed and erroneous variable could go unnoticed. Also, this seems to be > something that is knowable anyway and probably not too difficult to write a > custom fact that perhaps will take 2 puppet runs to fix. > > It just seemed to me that there must be some way to derive what is > installed on the client within a manifest but I couldn''t find any > suggestions on Google or PuppetLabs site so I asked. > > Thanks > > Craig > > -- > 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. > >-- 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.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1> It just seemed to me that there must be some way to derive what is > installed on the client within a manifest but I couldn''t find any > suggestions on Google or PuppetLabs site so I asked.Manifests are compiled to a catalog on the master. The catalog is then sent to the client, which only applies what the master compiled. The master can know about things of the client via facts. So if you want to know if something is on the client you need to write a custom fact for that. But wait a moment before you do that. As puppet is your CM-Tool of choice you would like to likely control things that are installed on the clients via puppet. And somewhere at some point you define your puppet client as an ldap server. As Nan suggested, this is the point where you should also add the ldap-server itself as client. Not? ~pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk4ycRsACgkQbwltcAfKi38zrwCePHUgFIOcnC1gJXhpJiWsLLGV /zEAoI2203IoWWambb3++gevlmyj5amG =UHs0 -----END PGP SIGNATURE----- -- 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 Jul 28, 2011, at 10:03 PM, Scott Smith wrote:> It looks like you''re wanting to do it via erb, but if you can perform whatever logic in the manifest, you can use tagged: > > (scott@cornstarch:tmp)% cat foo.pp > class foo { } > > class bar { > if (tagged("foo")) { > notice("You''re including foo") > } > } > > include foo, bar > (scott@cornstarch:tmp)% puppet foo.pp > notice: Scope(Class[Bar]): You''re including foo > notice: Finished catalog run in 0.01 seconds > (scott@cornstarch:tmp)%---- That worked perfectly (in the manifest which is precisely where I wanted it)... if (tagged("ldap::server_install")) { $ldap_servers = "ldap://127.0.0.1 ldap://ldap.ttinet" } else { ... first run too... Thanks Craig -- 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.