multitemplate
Version information
This version is compatible with:
- RedHat, Ubuntu, Debian, Fedora, CentOS
Start using this module
Add this module to your Puppetfile:
mod 'deanwilson-multitemplate', '1.0.2'
Learn more about managing modules with a PuppetfileDocumentation
Puppet Multiple Template Source Function
The multitemplate
Puppet function allows you to list multiple template
sources and use the first one that exists.
class ssh::config {
file { "/etc/ssh/sshd_config" :
ensure => present,
mode => '0600',
content => multitemplate( "ssh/${::fqdn}",
"ssh/${::domain}",
'ssh/default_sshdconfig'
),
}
}
While it's currently possible to invoke template
with multiple sources
specified it does not behave as most people expect. Instead of selecting
the first existing match it concatenates the templates together when used as below:
class ssh::config {
file { "/etc/ssh/sshd_config" :
ensure => present,
content => template( "ssh/${::fqdn}",
"ssh/${::domain}",
'ssh/default_sshdconfig'
),
}
}
This Puppet function was originally written by R.I.Pienaar and raised as Allow multiple sources for a template and only use the first template if it exists in the Puppet Issue tracker.
I've added all the usual module boilerplate scaffolding with permission.
Note: I will be more than happy to take this module down when the functionality is in core Puppet.
License
Apache 2.0 - Dean Wilson
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.