From 3aec1553fffa352e31a6dcab54dd5930028a47de Mon Sep 17 00:00:00 2001 From: Simon Heimberg Date: Wed, 2 Dec 2020 23:41:35 +0100 Subject: [PATCH] use term variable when passing variables to roles Use terms clearly. Role parameters exist as well (see #50278), but the example uses variables. So use the term variable. --- .../rst/user_guide/playbooks_reuse_roles.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst b/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst index 2e637cbb586336..8f0b53dad29d87 100644 --- a/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst +++ b/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst @@ -265,7 +265,7 @@ Variables of the role (from section `vars:` and from `roles/x/vars/main.yml`) ar Running a role multiple times in one playbook ============================================= -Ansible only executes each role once, even if you define it multiple times, unless the parameters defined on the role are different for each definition. For example, Ansible only runs the role ``foo`` once in a play like this: +Ansible only executes each role once, even if you define it multiple times, unless the variabless defined on the role are different for each definition. For example, Ansible only runs the role ``foo`` once in a play like this: .. code-block:: yaml @@ -278,10 +278,10 @@ Ansible only executes each role once, even if you define it multiple times, unle You have two options to force Ansible to run a role more than once. -Passing different parameters +Passing different variables ---------------------------- -You can pass different parameters in each role definition as: +You can pass different variables in each role definition as: .. code-block:: yaml @@ -305,7 +305,7 @@ or vars: message: "second" -In this example, because each role definition has different parameters, Ansible runs ``foo`` twice. +In this example, because each role definition has different variables, Ansible runs ``foo`` twice. Using ``allow_duplicates: true`` -------------------------------- @@ -334,7 +334,7 @@ Using role dependencies Role dependencies let you automatically pull in other roles when using a role. Ansible does not execute role dependencies when you include or import a role. You must use the ``roles`` keyword if you want Ansible to execute role dependencies. -Role dependencies are stored in the ``meta/main.yml`` file within the role directory. This file should contain a list of roles and parameters to insert before the specified role. For example: +Role dependencies are stored in the ``meta/main.yml`` file within the role directory. This file should contain a list of roles and variables to insert before the specified role. For example: .. code-block:: yaml @@ -343,21 +343,21 @@ Role dependencies are stored in the ``meta/main.yml`` file within the role direc dependencies: - role: common vars: - some_parameter: 3 + some_parameter_var: 3 - role: apache vars: apache_port: 80 - role: postgres vars: dbname: blarg - other_parameter: 12 + other_parameter_var: 12 Ansible always executes role dependencies before the role that includes them. Ansible executes recursive role dependencies as well. If one role depends on a second role, and the second role depends on a third role, Ansible executes the third role, then the second role, then the first role. Running role dependencies multiple times in one playbook -------------------------------------------------------- -Ansible treats duplicate role dependencies like duplicate roles listed under ``roles:``: Ansible only executes role dependencies once, even if defined multiple times, unless the parameters, tags, or when clause defined on the role are different for each definition. If two roles in a playbook both list a third role as a dependency, Ansible only runs that role dependency once, unless you pass different parameters, tags, when clause, or use ``allow_duplicates: true`` in the dependent (third) role. See :ref:`Galaxy role dependencies ` for more details. +Ansible treats duplicate role dependencies like duplicate roles listed under ``roles:``: Ansible only executes role dependencies once, even if defined multiple times, unless the variables, tags, or when clause defined on the role are different for each definition. If two roles in a playbook both list a third role as a dependency, Ansible only runs that role dependency once, unless you pass different variables, tags, when clause, or use ``allow_duplicates: true`` in the dependent (third) role. See :ref:`Galaxy role dependencies ` for more details. For example, a role named ``car`` depends on a role named ``wheel`` as follows: @@ -407,7 +407,7 @@ The resulting order of execution would be as follows: ... car -To use ``allow_duplicates: true`` with role dependencies, you must specify it for the dependent role, not for the parent role. In the example above, ``allow_duplicates: true`` appears in the ``meta/main.yml`` of the ``tire`` and ``brake`` roles. The ``wheel`` role does not require ``allow_duplicates: true``, because each instance defined by ``car`` uses different parameter values. +To use ``allow_duplicates: true`` with role dependencies, you must specify it for the dependent role, not for the parent role. In the example above, ``allow_duplicates: true`` appears in the ``meta/main.yml`` of the ``tire`` and ``brake`` roles. The ``wheel`` role does not require ``allow_duplicates: true``, because each instance defined by ``car`` uses different variable values. .. note:: See :ref:`playbooks_variables` for details on how Ansible chooses among variable values defined in different places (variable inheritance and scope).