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