Skip to content

Commit

Permalink
Fix problems with example inventory in the intro_patterns doc (#1138) (
Browse files Browse the repository at this point in the history
…#1158)

* 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.

(cherry picked from commit 80af576)

Co-authored-by: John Lamb <jolamb@redhat.com>
  • Loading branch information
patchback[bot] and dobbymoodge authored Feb 22, 2024
1 parent 9a1068e commit fa0ce3a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/docsite/rst/inventory_guide/intro_patterns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ Your pattern must match your inventory syntax. If you define a host as an :ref:`
.. code-block:: yaml

atlanta:
host1:
http_port: 80
maxRequestsPerChild: 808
host: 127.0.0.2
hosts:
host1:
http_port: 80
maxRequestsPerChild: 808
ansible_host: 127.0.0.2

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:

Expand Down

0 comments on commit fa0ce3a

Please sign in to comment.