Skip to content

Commit c562221

Browse files
amaraossbarnea
andauthored
doc: update doc on inventory/host section for provisioner (#3571)
* doc: update doc on inventory/host section for povisioner 1. Fix incorrect example, as 'hosts' should be two times, first time as a name for for 'inventory' section, and second, as normal ansible `hosts` stanza in the group. 2. Add well-known fact about incompatibility of sections of inventory and links. * pylint Co-authored-by: Sorin Sbarnea <[email protected]>
1 parent 6b78f79 commit c562221

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/molecule/provisioner/ansible.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# DEALINGS IN THE SOFTWARE.
2020
"""Ansible Provisioner Module."""
2121

22+
# pylint: disable=too-many-lines
2223
import collections
2324
import copy
2425
import logging
@@ -296,8 +297,9 @@ class Ansible(base.Base):
296297
inventory:
297298
hosts:
298299
all:
299-
extra_host:
300-
foo: hello
300+
hosts:
301+
extra_host:
302+
foo: hello
301303
302304
.. important::
303305
@@ -332,6 +334,7 @@ class Ansible(base.Base):
332334
The only valid keys are ``hosts``, ``group_vars`` and ``host_vars``. Molecule's
333335
schema validator will enforce this.
334336
337+
335338
.. code-block:: yaml
336339
337340
provisioner:
@@ -342,6 +345,25 @@ class Ansible(base.Base):
342345
group_vars: ../../../inventory/group_vars/
343346
host_vars: ../../../inventory/host_vars/
344347
348+
.. important::
349+
350+
You can use either `hosts`/`group_vars`/`host_vars` sections of inventory OR `links`.
351+
If you use both, links will win.
352+
353+
.. code-block:: yaml
354+
355+
provisioner:
356+
name: ansible
357+
hosts:
358+
all:
359+
hosts:
360+
ignored:
361+
important: this host is ignored
362+
inventory:
363+
links:
364+
hosts: ../../../inventory/hosts
365+
366+
345367
Override connection options:
346368
347369
.. code-block:: yaml

0 commit comments

Comments
 (0)