diff --git a/CHANGELOG.md b/CHANGELOG.md index 21063a7705b..5bd64fdc068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -288,6 +288,8 @@ Minor changes: * Many more tests. The new API makes things more testable and we took advantage of it. * big_ip modules now support turning off ssl certificate validation (use only for self-signed certificates). +* Use "pattern1:pattern2" to combine host matching patterns. The undocumented +use of semicolons or commas to combine patterns is no longer supported. * Use ``hosts: groupname[x:y]`` to select a subset of hosts in a group; the ``[x-y]`` range syntax is no longer supported. Note that ``[0:1]`` matches two hosts, i.e. the range is inclusive of its endpoints. diff --git a/docsite/rst/intro_patterns.rst b/docsite/rst/intro_patterns.rst index 6f76820e6a6..970ec58dc0c 100644 --- a/docsite/rst/intro_patterns.rst +++ b/docsite/rst/intro_patterns.rst @@ -27,7 +27,7 @@ The following patterns are equivalent and target all hosts in the inventory:: It is also possible to address a specific host or set of hosts by name:: one.example.com - one.example.com, two.example.com + one.example.com:two.example.com 192.168.1.50 192.168.1.* @@ -35,20 +35,20 @@ The following patterns address one or more groups. Groups separated by a comma This means the host may be in either one group or the other:: webservers - webservers,dbservers + webservers:dbservers You can exclude groups as well, for instance, all machines must be in the group webservers but not in the group phoenix:: - webservers,!phoenix + webservers:!phoenix You can also specify the intersection of two groups. This would mean the hosts must be in the group webservers and the host must also be in the group staging:: - webservers,&staging + webservers:&staging You can do combinations:: - webservers,dbservers,&staging,!phoenix + webservers:dbservers:&staging:!phoenix The above configuration means "all machines in the groups 'webservers' and 'dbservers' are to be managed if they are in the group 'staging' also, but the machines are not to be managed if they are in the group 'phoenix' ... whew! @@ -56,7 +56,7 @@ the group 'staging' also, but the machines are not to be managed if they are in You can also use variables if you want to pass some group specifiers via the "-e" argument to ansible-playbook, but this is uncommonly used:: - webservers,!{{excluded}},&{{required}} + webservers:!{{excluded}}:&{{required}} You also don't have to manage by strictly defined groups. Individual host names, IPs and groups, can also be referenced using wildcards:: @@ -66,7 +66,7 @@ wildcards:: It's also ok to mix wildcard patterns and groups at the same time:: - one*.com,dbservers + one*.com:dbservers You can select a host or subset of hosts from a group by their position. For example, given the following group::