On Mon, Apr 21, 2014 at 8:18 AM, Dan Pasacrita <whitewind...@gmail.com>wrote:

> Hi everyone, I'm pretty new to puppet, and I was wondering if you guys to
> help me with something pretty basic. I'm attempting to write a module that
> will check a text file for a certain line of text, and if it doesn't find
> it, to add a that content in a new line.
>
>
You want to use "unless" in your exec
http://docs.puppetlabs.com/references/latest/type.html#exec

Here are some example of what you're trying to accomplish:

http://projects.puppetlabs.com/projects/puppet/wiki/Simple_Text_Patterns/5

exec { "/bin/echo '${line}' >> '${file}'":
                unless => "/bin/grep -qFx '${line}' '${file}'"
            }

-- 
Steven KuryƂo

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMd2BmOaFSpafcxXZkJcTrrsfZreu55GKadFEz0VyA5KYu%2BUMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to