1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Added an example for paretheses

This commit is contained in:
Strahinja Kustudic 2014-10-05 19:54:31 +02:00
parent 05644686de
commit 3ca654ad9a

View file

@ -26,6 +26,14 @@ It's actually pretty simple::
command: /sbin/shutdown -t now command: /sbin/shutdown -t now
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
You can also use parentheses to group conditions::
tasks:
- name: "shutdown CentOS 6 and 7 systems"
command: /sbin/shutdown -t now
when: ansible_distribution == "CentOS" and
(ansible_distribution_major_version == "6" or ansible_distribution_major_version == "7")
A number of Jinja2 "filters" can also be used in when statements, some of which are unique A number of Jinja2 "filters" can also be used in when statements, some of which are unique
and provided by Ansible. Suppose we want to ignore the error of one statement and then and provided by Ansible. Suppose we want to ignore the error of one statement and then
decide to do something conditionally based on success or failure:: decide to do something conditionally based on success or failure::