How do you concatenate strings in a Puppet .pp file?

rlandster picture rlandster · Feb 14, 2013 · Viewed 68.8k times · Source

Here is my naive approach:

# puppet/init.pp
$x = 'hello ' + 
     'goodbye'

This does not work. How does one concatenate strings in Puppet?

Answer

czervik picture czervik · Feb 15, 2013

Keyword variable interpolation:

$value = "${one}${two}"

Source: http://docs.puppetlabs.com/puppet/4.3/reference/lang_variables.html#interpolation

Note that although it might work without the curly braces, you should always use them.