I think this is exactly what I've needed! Thanks a lot for your time and
patience explaining this. I'll test it on Monday and reverse to proper
module usage instead of shell + sed.
thanks!
On Saturday, November 18, 2017 at 5:17:48 PM UTC+2, Kai Stian Olstad wrote:
>
> 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/3be2b628-603f-439c-adb2-ee1255c146ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.