DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Ansible: Influencing Action Execution with Conditions and Branches

4 years ago medium.com
Ansible: Influencing Action Execution with Conditions and Branches

Summary: This is a summary of an article originally published by the source. Read the full original article here →

When you execute an Ansible playbook, all actions are run top-down, in the order they are written. There are cases when you need more control: You want to check a host that a certain software is installed, or you want to validate a certain condition and stop following actions when this condition is not fulfilled. In this article, I will cover the following options of influencing action execution: defining when to execute an action, defining when to stop an action, branching the control flow, and controlling action results.

Here is an example to install and configure the text editor nano if the variable software_package is defined and when it equals nano.

And finally, you can determine when an action is considered to have changed or failed.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com