Puppet DSL : String concatenation.

0 votes
is there a string concatenation operator in the Puppet DSL? It appears that there is currently no such thing. But how do i achieve the objective of string concatenation in puppet? How do I create a string composed of multiple string values?
Aug 8 in Puppet by Henry

1 answer to this question.

0 votes

Method 1: One way is 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.

Method 2: Another option is using Puppets sprintf() function, which functions identically to the ruby function behind it. 

An example:

$x = sprintf('hello user %s', 'CoolUser')

It is verified to work perfectly with puppet. This approach can also help you concatenate the output of functions.

answered Aug 8 by Sirajul
• 19,670 points

Related Questions In Puppet

+5 votes
2 answers

How To Deploy Windows Server Using Puppet?

Deploying windows server through Puppet is similar ...READ MORE

answered Mar 26, 2018 in Puppet by shubham
• 6,890 points
+1 vote
1 answer

Steps to trigger puppet agent from jenkins


answered Dec 16, 2018 in Puppet by Kiyara
0 votes
1 answer

Ram requirements for puppet installation

4 GB would be less for proper ...READ MORE

answered Dec 19, 2018 in Puppet by Alan
0 votes
1 answer
+13 votes
2 answers



answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
0 votes
1 answer
0 votes
1 answer

Puppet+kubernetes: How do I describe a Kubernetes Pod in Puppet DSL?

The Puppet Kubernetes module currently assumes you ...READ MORE

answered 4 days ago in Puppet by Sirajul
• 19,670 points
0 votes
2 answers

Where do i find the puppet configuration file?

The puppet.conf file is always located at $confdir/puppet.conf. Although ...READ MORE

answered Aug 9 in Puppet by Sirajul
• 19,670 points