Edgars
(Edgars)
1
Hi
Documentation says:
You can exclude groups as well, for instance, all webservers not in Phoenix:
webservers:!phoenix
But when I do so, I get:
[root@ansible playbooks]# ansible -o all:!webservers -u admin -k -K -m ping
bash: !webservers: event not found
To avoid this error, I have to escape exclamation mark:
[root@ansible playbooks]# ansible -o all:!webservers -u admin -k -K -m ping
Perhaps this is mentioned somewhere, but I couldn’t find. So it’s just FYI ![:wink: :wink:](/images/emoji/twitter/wink.png?v=12)
Edgars
You need to quote it for the shell
Edgars
(Edgars)
3
Ok I got it. I tried to quote with doublequotes and it didn’t work, but it appears that I need to use singlequotes.
jpmens1
4
But when I do so, I get:
[root@ansible playbooks]# ansible -o all:!webservers -u admin -k -K -m ping
> bash: !webservers: event not found
If you don't feel like escaping each '!', I'd
set +o histexpand
H which disables !-style history substitution. This
option is on by default when the shell is interactive."
-JP