hosts syntax?

Normally in my playbooks I say “hosts: all”. For a new playbook I want to say “hosts: !A,!B”, but that is not a valid syntax. What is the syntax to exclude two hosts (not in a group)?

Mike

You need something to negate

hosts: all:!A:!B

FYI all hosts are always in at least 2 groups, 'all' being always one
of them, if no other group is assigned 'ungrouped' becomes the 2nd.

Duh, thank you.

Mike