Skip to content

Commit 80af576

Browse files
authored
Fix problems with example inventory in the intro_patterns doc (#1138)
* invalid inventory format in patterns doc The example inventory placed the host alias directly in the `groups['atlanta']` dictionary, instead of in the `groups['atlanta']['hosts']` dictionary required by the inventory format. * Fix misleading hostvar name in example The documentation implies that ansible uses `hostvars['host1']['host']` to store the address of a target host (as specified in the example inventory), but in fact it would be stored in `hostvars['host1']['ansible_host']`. This is confusing for newcomers.
1 parent 9a5f50d commit 80af576

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/docsite/rst/inventory_guide/intro_patterns.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ Your pattern must match your inventory syntax. If you define a host as an :ref:`
111111
.. code-block:: yaml
112112

113113
atlanta:
114-
host1:
115-
http_port: 80
116-
maxRequestsPerChild: 808
117-
host: 127.0.0.2
114+
hosts:
115+
host1:
116+
http_port: 80
117+
maxRequestsPerChild: 808
118+
ansible_host: 127.0.0.2
118119

119120
you must use the alias in your pattern. In the example above, you must use ``host1`` in your pattern. If you use the IP address, you will once again get the error:
120121

0 commit comments

Comments
 (0)