mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
update conditional docs to clarify no mustaches required
This commit is contained in:
parent
81a49912b0
commit
ca183c5bd8
1 changed files with 3 additions and 1 deletions
|
@ -20,13 +20,15 @@ Sometimes you will want to skip a particular step on a particular host. This co
|
||||||
as simple as not installing a certain package if the operating system is a particular version,
|
as simple as not installing a certain package if the operating system is a particular version,
|
||||||
or it could be something like performing some cleanup steps if a filesystem is getting full.
|
or it could be something like performing some cleanup steps if a filesystem is getting full.
|
||||||
|
|
||||||
This is easy to do in Ansible, with the `when` clause, which contains a Jinja2 expression (see :doc:`playbooks_variables`).
|
This is easy to do in Ansible with the `when` clause, which contains a raw Jinja2 expression without double curly braces (see :doc:`playbooks_variables`).
|
||||||
It's actually pretty simple::
|
It's actually pretty simple::
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "shutdown Debian flavored systems"
|
- name: "shutdown Debian flavored systems"
|
||||||
command: /sbin/shutdown -t now
|
command: /sbin/shutdown -t now
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
# note that Ansible facts and vars like ansible_os_family can be used
|
||||||
|
# directly in conditionals without double curly braces
|
||||||
|
|
||||||
You can also use parentheses to group conditions::
|
You can also use parentheses to group conditions::
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue