Not that it matters, but I am trying to use a module out of puppet forge - camptocamp-openldapThere's no hint of using it anywhereIt has an unusual style. There isn't any init.pp and the structure looks like this...
├── client│  ├── config.pp│  ├── install.pp│  ├── ldapvi.pp│  └── utils.pp├── client.pp├── server│  ├── access.pp│  ├── config.pp│  ├── database.pp│  ├── dbindex.pp│  ├── globalconf.pp│  ├── install.pp│  ├── module.pp│  ├── overlay.pp│  ├── service.pp│   └── slapdconf.pp├── server.pp└── wl.pp
The last file - wl.pp is my own file and it looks like this... $ensure   = present $directory = '/var/lib/ldap' $rootdn   = 'cn=admin,dc=wl,dc=com' $rootpw   = 'password' $dn     = 'dc=wl,dc=com' # Install openldap server class { 'openldap::server': } openldap::server::database { $dn:  ensure => present,  rootdn => "cn=admin,${dn}",  rootpw => $rootpw, }
and if I use 'puppet apply -vd --modulepath /etc/puppet/modules wl.ppit works fine but I can't put those variables into the server.pp file or any of the files in the /server subdirectory because they don't work.
I need a method - I thought a class openldap::wl class but I can't make that work either. How do I structure this so I can use one class to configure clients without resorting to re-writing the module completely so it comports to a style that I understand?
On Monday, November 17, 2014 4:40:28 PM UTC-6, Craig White wrote:The last file - wl.pp is my own file and it looks like this... $ensure   = present $directory = '/var/lib/ldap' $rootdn   = 'cn=admin,dc=wl,dc=com' $rootpw   = 'password' $dn     = 'dc=wl,dc=com' # Install openldap server class { 'openldap::server': } openldap::server::database { $dn:  ensure => present,  rootdn => "cn=admin,${dn}",  rootpw => $rootpw, }
Oh no, no, no. You should not add code to a module in order to use the module. Moreover, you should have top-level declarations only in your site manifest. Your wl.pp is in fact functioning as a site manifest when you name it in a 'puppet apply' run, so it's not necessarily wrong in itself, it just doesn't belong in the module (and putting it there confers no particular advantage).
Âand if I use 'puppet apply -vd --modulepath /etc/puppet/modules wl.ppit works fine but I can't put those variables into the server.pp file or any of the files in the /server subdirectory because they don't work.
I'm not clear on what you're trying to do. When you say "it works" do you mean that wl.pp achieves everything you're after, or just that it runs without error?
ÂI need a method - I thought a class openldap::wl class but I can't make that work either. How do I structure this so I can use one class to configure clients without resorting to re-writing the module completely so it comports to a style that I understand?Â
Well, it looks like you configure clients by declaring instances of class openldap::client, which sounds like what you want. The module seems actually to have reasonably good documentation, including examples, at the URL you provided.
If you use hiera and puppet 3 (or later), you can use the automatic class parameters for that, and just 'include openldap::server::database'.
Of cause you can set up some class parameters on your own class if you want to and do that.
Typically, this is where I would use hiera for.
OK - but I still need to figure out how to call one class with parameters from another class...class wl::config { :  class openldap::server::database { $dn:  ensure => present,  rootdn => "cn=admin,${dn}",  rootpw => $rootpw, }}
class { 'mymodule::myclass':
 param1 => value1,
 param2 => value2
}
openldap::server::database { $dn:
 ensure => present,
 rootdn => "cn=admin,${dn}",
 rootpw => $rootpw,
}