Lowercase variable values in a Puppet template

puppetstrings

In my puppet config I need to lowercase a variable value before using it in a template. How to achieve this? Is there a way to lowercase a variable value inside the puppet manifest? Do I need to do this in the template?

And more general: where are string manipulation functions that I could use in manifests.

Do I have to write my own custom ruby functions to achieve this?

Best Answer

Puppet's string manipulation capabilities inside manifests are very limited. Manifests aren't really intended to handle stuff like this.

But, in the template, it's easy; normal ruby functions are available. Say I wanted a lowercase of the osfamily fact:

<%= osfamily.downcase %>