[英]evaluation of when condition in ansible
我有一本剧本,它使用多个主机组,例如(appserver,app01server,dbserver,db01server),如果主机组包含db *,则条件应执行。 我写了这样的东西:
- name: status of the app
shell: echo "Hello World"
when: ansible_host == "db*"
这里应该使用哪种正则表达式模式或如何使用正则表达式?
尝试db \\ w +
- name: status of the app
shell: echo "Hello World"
when: ansible_host == "db\w+"
您可以使用regex101进行测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.