Skip to content

Commit

Permalink
INI inventory: add doc about variable types
Browse files Browse the repository at this point in the history
  • Loading branch information
pilou- committed Jun 16, 2017
1 parent 0d13ea9 commit 3634b21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/docsite/rst/intro_inventory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Suppose you have just static IPs and want to set up some aliases that live in yo
In the above example, trying to ansible against the host alias "jumper" (which may not even be a real hostname) will contact 192.0.2.50 on port 5555. Note that this is using a feature of the inventory file to define some special variables. Generally speaking this is not the best
way to define variables that describe your system policy, but we'll share suggestions on doing this later. We're just getting started.

.. note:: Values passed in using the ``key=value`` syntax are interpreted as Python literal structure (strings, numbers, tuples, lists, dicts,
booleans, None), alternatively as string. For example ``var=FALSE`` would create a string equal to 'FALSE'. Do not rely on types set
during definition, always make sure you specify type with a filter when needed when consuming the variable.

Adding a lot of hosts? If you have a lot of hosts following similar patterns you can do this rather than listing each hostname:

.. code-block:: ini
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/plugins/inventory/ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
- The C(children) modifier indicates that the section contains groups.
- The C(vars) modifier indicates that the section contains variables assigned to members of the group.
- Anything found outside a section is considered an 'ungrouped' host.
- Values passed in using the C(key=value) syntax are interpreted as Python literal structure (strings, numbers, tuples, lists, dicts,
booleans, None), alternatively as string. For example C(var=FALSE) would create a string equal to 'FALSE'. Do not rely on types set
during definition, always make sure you specify type with a filter when needed when consuming the variable.
notes:
- It takes the place of the previously hardcoded INI inventory.
- To function it requires being whitelisted in configuration.
Expand Down

0 comments on commit 3634b21

Please sign in to comment.