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!!