On Thursday, March 20, 2014 1:26:56 PM UTC-5, Peter Bukowinski wrote: > > On Mar 20, 2014, at 1:26 PM, John <sami....@gmail.com <javascript:>> > wrote: > > Below is a my current config,.pp file.... I'm trying to create a > condition that says > > if (/etc/ldap.conf contains the string host1.mydomain.com or > host2.mydomain.com) > Then install an sshd_ldap.erb template > else if (/etc/ldap.conf contains the string hostB.mydomain.com or > hostA.mydomain.com) > Then install an sshd_freeIPA.erb template > else install a standard template. > > The code does not work as written. Any advice to suggestions would be > greatly appreciated. > > Thanks in advance. > > class ssh::config inherits ssh { > file_content { '/etc/ldap.conf': > ensure => file, > } > > > I understand what you're trying to do here, but you seem to have made up > some puppet code that it won't know how to handle. You're trying to define > a variable by using puppet's resource language. That's not going to work. > > What you'll need to do is write a custom facter fact, e.g. 'ldapserver', > that will contain the name(s) of the configured ldap server(s). I do this > in my environment with the following code, which I place into a puppet > module named 'custom' (as documented here > http://docs.puppetlabs.com/guides/plugins_in_modules.html): > >
+1 Alternatively, it is often better for Puppet to tell instead of ask. That is, where possible, you should avoid making your nodes authorities for information that is not directly tied to their identities and hardware. If you adhere to that principle, then instead of using nodes' LDAP configuration to determine which SSH configuration to apply, you would manage *both* to appropriate, consistent states. John -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/6dd95dc0-9a99-42ca-b1cf-e4801934dffc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.