对于一个组名hello ,我使用以下条件在ansible中,它工作正常:
when: "'hello' in group_names "
如果我想在以下group_names中匹配关键字hello ,有没有办法使用正则expression式:
hello somewhere_hello hello123
您可以select和计数具有filter的项目:
when: group_names | select('search','hello') | list | count > 0