Define group in hosts file based on intersection of 2 groups

Hello,

It is possible to limit the hosts the ansible command runs against by specifying patterns on the command line like so:

ansible webservers:!staging -m ping

Is it possible to use the same technique to define groups in the inventory file, so that the new group is defined by the intersection of 2 child groups?

Thanks

Iain

No, that is only available in the hosts: clause of a play, with --limit and for ansible in the host pattern specified (equivalent to hosts: in a play).

That should be possible.
I have been doing something like that using the escape character in command line. Ansible version 2.3
ansible webserver:&dev -m ping
ansible webserver:!prod -m ping

Thanks.