Skip to content

Commit

Permalink
fix: Remove stray reference to group_by_module (#2142) (#2144)
Browse files Browse the repository at this point in the history
Reference to group_by_module was substituted in where it did not make
sense:  ansible/ansible#43856

This reference is not essential.  It is already referenced
indirectly, via :ref:`os_variance`.

Revert back to referencing the variables page.

Credit for fix and diagnosis: @samccann.  See issue #2077.

(cherry picked from commit 4f0f5d1)

Co-authored-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
  • Loading branch information
patchback[bot] and sourcejedi authored Nov 18, 2024
1 parent a743f0b commit e17560a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/docsite/rst/playbook_guide/playbooks_conditionals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Ansible uses Jinja2 :ref:`tests <playbooks_tests>` and :ref:`filters <playbooks_
Basic conditionals with ``when``
================================

The simplest conditional statement applies to a single task. Create the task, then add a ``when`` statement that applies a test. The ``when`` clause is a raw Jinja2 expression without double curly braces (see :ref:`group_by_module`). When you run the task or playbook, Ansible evaluates the test for all hosts. On any host where the test passes (returns a value of True), Ansible runs that task. For example, if you are installing mysql on multiple machines, some of which have SELinux enabled, you might have a task to configure SELinux to allow mysql to run. You would only want that task to run on machines that have SELinux enabled:
The simplest conditional statement applies to a single task. Create the task, then add a ``when`` statement that applies a test. The ``when`` clause is a raw Jinja2 expression without double curly braces (see :ref:`jinja2_simple`). When you run the task or playbook, Ansible evaluates the test for all hosts. On any host where the test passes (returns a value of True), Ansible runs that task. For example, if you are installing mysql on multiple machines, some of which have SELinux enabled, you might have a task to configure SELinux to allow mysql to run. You would only want that task to run on machines that have SELinux enabled:

.. code-block:: yaml
Expand Down
2 changes: 2 additions & 0 deletions docs/docsite/rst/playbook_guide/playbooks_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ You can define a simple variable using standard YAML syntax. For example:

remote_install_path: /opt/my_app_config

.. _jinja2_simple:

Referencing simple variables
----------------------------

Expand Down

0 comments on commit e17560a

Please sign in to comment.