Search code examples
puppet

Use a puppet module multiple times


I'm using a puppet module from Puppet Forge - https://forge.puppet.com/creativeview/mssql_system_dsn

The documentation indicates to use it like this:

class {'mssql_system_dsn':
    dsn_name     => 'vcenter',
    db_name      => 'vcdb',
    db_server_ip => '192.168.35.20',
    sql_version  => '2012',
    dsn_64bit    => true,
}

I need to create multiple odbc data sources.

However, if I simply duplicate this snippet twice and change the parameters I get a multiple declaration error.

How can I declare this module multiple times?


Solution

  • How can I declare this module multiple times?

    You cannot do so without modifying the module. Although it is possible to declare the same class multiple times if you use include-like syntax, that does not afford a means to use different parameters with different declarations. This is all connected to the fact that Puppet classes are singletons. I can confirm based on a quick review of the module's code that its design does not support defining multiple data sources.

    I'd encourage you to file an enhancement request with the module author. If that does not quickly bear fruit, then you have the option of modifying the module yourself. It looks like that would be feasible, but not as simple as just changing a class keyword to define.