How to store linux command output into a variable in puppet

谁说我不能喝 提交于 2019-11-30 13:54:04

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:

$password = "12345"

$secretvalue = inline_template("<%= `/bin/echo ${password} | /usr/bin/base64` %>")

notify { "STDOUT: ${secretvalue}": }

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

$secretvalue = base64('encode', $password)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!