组关键字:group_names
例子:
---
- hosts: "{{ hosts }}"
gather_facts: true
tasks:
- name: "Check MySQL1"
shell: ps -ef|grep mysqld | grep 3306 | grep -v grep | wc -l
when:
- "'mysql' in group_names"
- name: "Check tomcat01"
shell: ps -ef|grep tomcat | grep -v grep | wc -l
when:
- "'mysql' not in group_names"