Host/Group Target Patterns
-----
OR (group1:group2)
NOT (!group2)
Wildcard (web*.ex.com)
Regex (~web[0-9]+) --> All systems that have web and number at the end.
Complex Patterns:
--
AND (group1:&group2) --> hosts, which are joined in both group1 and group2 (Intersection).
Bit more complex:
-----
webservers:&prod:!python3 --> Hosts defined in Webservers AND Prod but NOT in Python3
Example:
----------------
To stop firewall:
ansible webservers:dbservers -i inventory -m service -a "name=iptables state=stopped" --sudo
No comments:
Post a Comment