ansible Tutorial => When Condition
riptutorial.com › ansible › exampleBasic Usage#. Use the when condition to control whether a task or role runs or is skipped. This is normally used to change play behavior based on facts from the destination system. Consider this playbook: - hosts: all tasks: - include: Ubuntu.yml when: ansible_os_family == "Ubuntu" - include: RHEL.yml when: ansible_os_family == "RedHat".
How to Work with Ansible When and Other Conditionals
adamtheautomator.com › ansible-wheOct 14, 2021 · Ansible when and other conditionals lets you evaluate conditions, such as based on OS, or if one task is dependent on the previous task. In this tutorial, you’re going to learn how to work with Ansible when and other conditionals so you can execute tasks without messing things up. Let’s get into it! Table of Contents Prerequisites
Conditionals — Ansible Documentation
docs.ansible.com › ansible › latestDec 21, 2021 · 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.