I have a task that searches logs for specific errors in various logs (up to 
7 days worth of logs).  When searching through just one log I never had an 
issue, but when searching through the 7 logs (used a wildcard to accomplish 
this), sometimes Ansible goes to lunch and doesn't recover.  It just sits 
there like it is still executing.  We have let it run for many hours in 
that state just to make sure.  I think it has a lot to do with timing 
and/or the size of the files (and the number of errors found int he 
files).  Wondering if there is a more robust way to address this so that it 
will either not hang, continue on after a certain point (maybe a 5 minute 
timeout) or be more efficient (such as searching logs and writing to a file 
with an ansible module I don't know of)?  

- name: Gather error reports
  shell: |
          while read line; do
            grep -i "$line" "{{ log_source }}"* | uniq  > "{{ dest_dir 
}}/{{ ansible_hostname }}-$line.txt"
          done < "{{ error_log }}"
  failed_when: false
  args:
    executable: /bin/bash


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/af6c88f5-5270-4c57-839e-0205547b31b7%40googlegroups.com.

Reply via email to