Hi Kai/Team,

Can you give me a small example of using file module for matching strings 
in the file?

On Tuesday, 20 February 2018 23:24:39 UTC+5:30, Kai Stian Olstad wrote:

> On Tuesday, 20 February 2018 18.38.06 CET Shreela Roy wrote: 
> > I am running an ansible playbook for patching the nodes from the control 
> > server. I want to set up a check which would check for the word 
> COMPLETED 
> > in the file: 
> > 
> > something like: 
> > /var/log/12-2017PM-PATCH.log| grep -o COMPLETED 
> > 
> > But cannot find the way out for checking each of the nodes and then if 
> > successfully finds the word COMPLETED would reboot the servers one by 
> one. 
> > and leaves the server where its not completed. 
>
> You can use file module, it has the option contain that will search for a 
> string in the file. 
> Register the output from find and then check that matched == 1 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/26dd522f-a886-4ebd-be00-00d0a4b3cd89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to