http://projects.puppetlabs.com/projects/1/wiki/Simple_Text_Patterns
define replace($file, $pattern, $replacement) { exec { "/usr/bin/perl -pi -e 's/$pattern/$replacement/' '$file'": onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /$pattern/ && ! /$replacement/ ; END { exit \$ret; }' '$file'", } } Example: replace { "/etc/bashrc": file => "/etc/bashrc", pattern => "PS1", replacement => "PS1 DOMAINA.COM" }
Не безопасно это.
ОтветитьУдалить