Re: [ansible-project] why does this loop/when fail

2022-11-28 Thread Rob Wagner
Thanks Racke, but I just tried: - name: task 3 debug: msg: "{{ item }} is in s" loop: "{{ t_list }}" when: ( item | regex_replace('^p(\d+).*$', '\1') ) in s It fails. Only works with \\1. On Mon, Nov 21, 2022 at 9:52 AM Stefan Hornburg (Racke) wrote: > On 21/11/2022

Re: [ansible-project] why does this loop/when fail

2022-11-21 Thread Stefan Hornburg (Racke)
On 21/11/2022 14:01, rjwagn...@gmail.com wrote: Wow.  Never would have thought to try that.  Escaping in YAML/Jinja is such an unintuitive mess.  Thanks so much, Andrew. It is easier though when you use single quotes for the arguments of the regex_replace filter. Regards    Racke

Re: [ansible-project] why does this loop/when fail

2022-11-21 Thread rjwagn...@gmail.com
Wow. Never would have thought to try that. Escaping in YAML/Jinja is such an unintuitive mess. Thanks so much, Andrew. On Friday, November 18, 2022 at 4:59:47 PM UTC-5 lat...@gmail.com wrote: > > > ok, here it is. should be \\1 vs \1 in your replacement and test(is) > on string

Re: [ansible-project] why does this loop/when fail

2022-11-18 Thread Andrew Latham
ok, here it is. should be \\1 vs \1 in your replacement and test(is) on string contents(in) - name: task 3 debug: msg: "{{ item }} is in the s" loop: "{{ t_list }}" when: ( item | regex_replace("^p(\d+).*$", "\\1") ) is in s - name: task 3.orig debug: msg: "{{

Re: [ansible-project] why does this loop/when fail

2022-11-18 Thread Andrew Latham
Rob Trying to follow along, So on Task 3 you want to iterate over the list t_list and match if the digit is in variable s? First thought is that you are testing if an int is a string. On Fri, Nov 18, 2022 at 12:00 PM rjwagn...@gmail.com wrote: > Hey all - I think I'm losing my mind. Can

[ansible-project] why does this loop/when fail

2022-11-18 Thread rjwagn...@gmail.com
Hey all - I think I'm losing my mind. Can anyone explain why every iteration of task 3 is being skipped (compare w/ task 2, especially)? (ansible2_12_8) rowagn@mlb656 client % cat d.yml - hosts: all gather_facts: no vars: s: '1 2 3' t: p1_xyz t_list: - p1_xyz -