On Friday, 17 November 2017 09.03.55 CET Andrei Baban wrote:
> thanks! 
> 
> I'll research this a bit more, as I still don't see a clear way yet on how 
> to condition the second loop to run only on a subset of properties read 
> from the variable file; but the loop_control is a good start. 

This is not 100% correct code, just an idea on how it could be solved with the 
information you provided in the fist mail.

  vars:
    patterns:
      - file: file_*.xml
        regexp: 17701
        replace: 17706
      - file: other_file.xml
        regexp: a
        replace: b

  tasks:
    - include: change.yml
      with_items: '{{ patterns }}'
      loop_control:
        loop_var: outer_item


change.yml
---
- find:
    paths: /your/path
    patterns: '{{ outer_item.file }}'
  register: filelist

- name: perform pattern replaces for files
  local_action:
    module: replace
    follow: yes
    path: '{{ item.path }}'
    regexp: '{{ outer_item.regexp }}'
    replace: '{{ outer_item.replace }}'
  with_items: "{{ filelist.files }}"


-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3538493.eWg0plj3kj%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to