Ask Your Question

Revision history [back]

dummy::parfil{$filename:} declares a defined type with the title of $filename. In your code example, the type would be defined twice, once with the $title 'a', and once with the $title 'b'.

With a defined type, the title of the resource is assigned to the variable $title and $name. The resource title is not assigned to a parameter.

Your defined type has a required parameter called $filename. You aren't supplying a value for $filename, so a parse error is being raised. Puppet is expecting this:

dummy::parfil { 'a':
  filename => 'a'

Try this:

define dummy::parfil (
  $filename = $title,
  ) {
  file {$filename:
    ensure => 'file',
    path => "/etc/dummy/manifests/${filename}"

This is also acceptable:

define dummy::parfil ( ) {
  file {$title:
    ensure => 'file',
    path => "/etc/dummy/manifests/${title}"

See the defined type documentation for more info.