I'm a newbie and I might be missing something... but let me try to explain what I want to accomplish and how I would like to do it.I'm installing ssh by using the saz::ssh module. This module provision the sshd_config file with the ssh configuration.I need to tune the sshd_config file, so I have a module, say patxi::scstack that includes ssh and tries to overwrite the sshd_config by defining this file again:class scstack_ssh {include sshfile { "/etc/ssh/sshd_config":content => template("scstack/sshd_config"),}}This approach fails as expected:Duplicate declaration: File[/etc/ssh/sshd_config] is already declared in file /tmp/vagrant-puppet/modules-0/ssh/manifests/server/config.pp at line 11; cannot redeclare at /tmp/vagrant-puppet/modules-0/scstack/manifests/scstack_ssh.pp:67The alternative could be to fork the module saz::ssh and change the sshd_config file it provides to fit my needs. However, this seems odd to me. I want to use the ssh puppet module as is, without any modification, so as to be able to update this module if the original author makes changes to it. In my humble opinion having to modify modules to fit my needs limits reusing of puppet modules.My question is: how can I achieve what I want? I see different options but I would like to know how to do it "the puppet way":
- Modify the original ssh module to include my sshd_config file
- Modify the original ssh module to include a location parameter to use as source ("puppet:///$location") for sshd (I don't know it parameters can be used in place for puppet:// urls)
- Provision the file in my module using another name and do an exec to rename it, overwriting the one generated by the ssh module
- ...Any other option?
Thanks, John.I think I would go through the 4th option (subclassing) as you suggested. However, I don't know which are the interface classes of a module.
The interface classes of a module are whatever its documentation says
they are. More often than not, the docs
don’t explicitly designate interface classes, but they should identify the
classes you are expected to use -- those are the interface classes. Ideally for your case, the docs would specifically say that a particular one of the interface classes manages the file in question.
Important: do not attempt to subclass a parameterized class. If the class that would need to be subclassed is parametrized, then option 4 is a non-starter.
John