Skip to content

Commit

Permalink
Merge pull request ansible#16465 from nitzmahone/no_mustaches_docfix
Browse files Browse the repository at this point in the history
update conditional docs to clarify no mustaches required
  • Loading branch information
nitzmahone authored Jun 27, 2016
2 parents 81a4991 + ca183c5 commit 1e62876
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docsite/rst/playbooks_conditionals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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::

tasks:
- name: "shutdown Debian flavored systems"
command: /sbin/shutdown -t now
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::

Expand Down

0 comments on commit 1e62876

Please sign in to comment.