Iterating over resources in puppet templates

Posted by daveg on Server Fault See other posts from Server Fault or by daveg
Published on 2012-03-21T10:29:11Z Indexed on 2012/03/21 11:31 UTC
Read the original article Hit count: 200

Filed under:
|

So I've got a puppet manifest, with multiple resources

class foo {
  Custom::Resource {'resource1':
      attr1 => 'val1',
      attr2 => 'val2',
  }
  Custom::Resource {'resource2':
      attr1 => 'val3',
      attr2 => 'val4',
  }
  Custom::Resource {'resource3':
      attr1 => 'val5',
      attr2 => 'val6',
  }
}

If I wanted to loop over the Custom::Resource resource names in an .erb template that are defined in class foo, how do I access them? So if I wanted to write out a template that looked like this:

ThisLine = resource1
ThisLine = resource2
ThisLine = resource3

© Server Fault or respective owner

Related posts about puppet

Related posts about templates