Skip to content
Advertisement

How to store linux command output into a variable in puppet

Is it possible to store a linux command result in variable?

I am trying to store an encrypted value in a variable. To encrypt I am using base64 command. To store it in variable, I am using generate method. But I am not able to store a value.

JavaScript

Advertisement

Answer

If you want to execute any command on Puppet Master server you can use inline_template function with ERB template inside and Ruby code for execute shell command:

JavaScript

P.S. If you just want to encode string to Base64 format you can import puppetlabs-stdlib module and use base64 function from it:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement