Jinja2 filter list using string contains test

后端 未结 4 1631
遥遥无期
遥遥无期 2021-02-20 06:01

I\'m trying to filter a list in ansible in Jinja2 when the elements contain a string, but the Jinja documentation doesn\'t seem clear enough for me to figure it out.

Thi

4条回答
  •  自闭症患者
    2021-02-20 06:08

    I understand there may be more than one way to do this. Will this work for you?

      - debug: var={{item}}
        when: item.find('running script') > -1
        with_items: script_results.stdout_lines
    

提交回复
热议问题