Hey all,

So I'm trying to do a check to see if a string exists in a file and to add
if it does not.

This is what I have:

- name: exists in file
  command: "grep string /var/log/file"
  register: string_not_exist

- name: run_if_exists
  command: "touch /tmp/add"
  when: string_not_exist.stdout == 1

This doesn't work.  :(  Any help would be appreciated!!
--

-- 
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/CAHKi8CjmJsLUz2Nkf3sjhLLGQ_RCR-Ud6GGNaH70vPG_b5Hx8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • [ansible-project] Condi... 'Chris Bidwell - NOAA Federal' via Ansible Project

Reply via email to