Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The when clause is a raw Jinja2 expression without double curly braces (see group_by_module)" #2077

Open
sourcejedi opened this issue Oct 29, 2024 · 2 comments
Labels
good first issue Good for newcomers new_contributor This PR is the first contribution by a new community member.

Comments

@sourcejedi
Copy link
Contributor

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`)

File: docs/docsite/rst/playbook_guide/playbooks_conditionals.rst

I found the parenthetical confusing. group_by_module does not have any explanation about "a raw Jinja2 expression without double curly braces".

There is one mention of "when": group_by_module does not support the "when statement". But I don't know why this needs to be pointed out, in the introduction to conditionals.

I think the parenthetical could be removed?

@ansible-documentation-bot ansible-documentation-bot bot added needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. labels Oct 29, 2024
@ansible-documentation-bot
Copy link
Contributor

Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the dawgs-meeting tag to a forum topic to bring it up at the next meeting.

@samccann samccann removed the needs_triage Needs a first human triage before being processed. label Nov 12, 2024
@samccann
Copy link
Contributor

Thanks @sourcejedi for opening the issue... It took some real archeological digging in the git history to see where and why this changed. (For the curious - it changed with this PR).

Documentation fix:

  1. Add an rst anchor at https://github.com/ansible/ansible-documentation/blob/devel/docs/docsite/rst/playbook_guide/playbooks_variables.rst?plain=1#L58 - something like jinja2_simple
  2. Change the group_by_module ref at
    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:
    to use the new anchor introduced in step 1.

@sourcejedi we'd welcome a PR that does this if you're up for it. And thanks again for catching this! It's been around for ...ages.

@samccann samccann added the good first issue Good for newcomers label Nov 12, 2024
sourcejedi added a commit to sourcejedi/ansible-documentation that referenced this issue Nov 13, 2024
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 ansible#2077.
samccann pushed a commit that referenced this issue Nov 13, 2024
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.
patchback bot pushed a commit that referenced this issue Nov 13, 2024
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)
patchback bot pushed a commit that referenced this issue Nov 13, 2024
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)
patchback bot pushed a commit that referenced this issue Nov 13, 2024
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)
patchback bot pushed a commit that referenced this issue Nov 13, 2024
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)
samccann pushed a commit that referenced this issue Nov 18, 2024
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>
samccann pushed a commit that referenced this issue Nov 18, 2024
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>
samccann pushed a commit that referenced this issue Nov 18, 2024
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>
samccann pushed a commit that referenced this issue Nov 18, 2024
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>
oraNod pushed a commit that referenced this issue Nov 25, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers new_contributor This PR is the first contribution by a new community member.
Projects
Status: 🆕 Triage
Development

No branches or pull requests

2 participants