Grep a string in puppet

asked 2017-10-30 06:52:13 -0500

Anu Thakur gravatar image

I need to grep a string in a line using puppet using regular expressions. $var=['varms01' , 'varms02']

I need to run puppet exec onlyif varms01 and varms02 are not present in my config file. I am not sure How to implement this.

edit retag flag offensive close merge delete


Where does your “line” come from? Can't you just specify `unless => '/bin/grep "varms0[12]" /path/to/file'` to your Exec resource?

Kai Burghardt gravatar imageKai Burghardt ( 2017-10-30 08:10:33 -0500 )edit

yes this worked, Thanks Kai.

Anu Thakur gravatar imageAnu Thakur ( 2017-11-16 01:07:43 -0500 )edit