Giter VIP home page Giter VIP logo

puppet-multitemplate's Introduction

Puppet Multiple Template Source Function

The multitemplate Puppet function allows you to list multiple template sources and use the first one that exists.

Build Status Puppet Forge

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.

Installation

You can install this module from PuppetForge:

puppet module install deanwilson-multitemplate

License

Apache 2.0 - Dean Wilson

puppet-multitemplate's People

Contributors

deanwilson avatar dependabot[bot] avatar dependabot-preview[bot] avatar tomnatt avatar

Stargazers

Kirill Trofimov avatar Dave Wongillies avatar Andrew Spiers avatar Flavius Aspra avatar Ky-Anh Huynh avatar

Watchers

 avatar James Cloos avatar  avatar

puppet-multitemplate's Issues

puppet-server-3.5.1 breaks multitemplate module

After I updated my puppetmaster to puppet-server-3.5.1-1.el6.noarch I started getting an error on clients that use the multitemplate module:

Here is the use manifest snipet:
file { "/etc/my.cnf":
ensure => present,
owner => "root",
group => "root",
mode => 644,
content => multitemplate("dbmysql/mysql/$dev_role/$fqdn", "dbmysql/mysql/$dev_role/default"),
} ->

Here is the error:
Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `module' for "production":String at /etc/puppet/modules/dbmysql/manifests/mysqlsetup.pp:20 on node dbstg.domain.com

My guess is it has to do with the "Dynamic Environment Fixes" in 3.5.1: http://docs.puppetlabs.com/puppet/3.5/reference/release_notes.html#dynamic-environment-fixes

Create Release-Tags

Please create new Release-Tags. v1.0.2 is of 2015-11-27.
We use Renovate to keep our Puppetfile up-to-date. But this only works with Release-Tags.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.