2

I want to limit an ansible run to all webservers which are not in the windows group. I get this done when I create a new group:

[test]
webservers:!windows

and run it like this:

ansible-playbook -i inventories/staging/ site.yml --limit test

But when I try to avoid the group definition and put all into the limit statement it fails with !windows event not found

ansible-playbook -i inventories/staging/ site.yml --limit "webservers:!windows" 

Is this not supported or do I something wrong?

Michael Hoeller
  • 22,018
  • 10
  • 39
  • 66

1 Answers1

7

! is a special character in bash to expand previous commands.

You should use single quotes to avoid bash expansion: --limit 'webservers:!windows'

Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193