ansible - Iterating over stdout -


i writing playbook locate string pattern in sequence of files. if run utility through command module generate 1 or more strings on stdout. run across number of systems run command with_items:

  - command: "findstring {{ item }}"   with_items:     - "string1"     - "string2"   register: found   failed_when: found.rc >= 2 

and iterate on result post process info:

 - name: print strings found       debug:      var: "{{ item }}"       with_items: found.results 

is there equivalent loop.index can used "results" in task above? allow me {{ item[index].stdout }} strings generated. haven't been able find answer in official documentation thought post here see gurus think.

if need iterate on every line commands, use:

- debug:     msg: "do smth line {{ item }}"   with_items: "{{ found | json_query('results[].stdout_lines[]') }}" 

this take ever element found.results, every element every stdout_lines.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -