Playbooks are Ansible’s configuration, deployment, and orchestration language. Playbooks are expressed in YAML format (see YAML Syntax) and have a minimum of syntax, which intentionally tries to not be a programming language or script, but rather a model of a configuration or a process.
Usually we are specifying one group of hosts at time in the playbook. But there is option to specify multiple groups simultaneously in one playbook.
Here we need to specify the different groups in collon separated format.
- hosts: group1:group2