Articles by admin


Ansible_Logo

Ansible: Automation using conditions

While ansible runs playbook on group of managed nodes which are also present in the Inventory file, we can run tasks on selected nodes based on defined conditions. For example we may want to install…


Ansible_Logo

Ansible: Roles

Roles is a feature provided by Ansible were once a standardized directory structure is created, you can automatically load related vars, files, tasks, handlers, and other Ansible artifacts. Using roles we have opportunities to reuse code from playbooks that…


Ansible_Logo

Ansible: Including tasks files and importing playbooks

The include_tasks module imports a list of tasks to the current playbook for execution. It is one way for organizing tasks in separate files and it also helps in reusing the tasks in other playbooks….


Ansible_Logo

Ansible – The fetch module to retrieve files

While the copy module helps to copy a file from the controller node to managed nodes, the fetch module helps to retrieve files from a managed node to controller node. In the below example we will…


Ansible_Logo

Ansible – Blocks, Rescue and Error Handling

Usually the Handlers work with a single task. However the “blocks” feature in Ansible helps us to group multiple tasks under one block section and attach handlers or rescue feature to it. In the below…


Ansible_Logo

Ansible – Error Handling

Do not misunderstand the concept error handling in this document with error handling in usual software programming terminology. Usually when one writes a program, a syntax check will check for syntax including indentation, spacing, etc. But…


Ansible_Logo

Ansible – Enabling Handlers – Success handlers

At times when certain tasks are executed by a playbook, it may be desired to run certain other task immediately. However, if the first task did not get executed successfully for what ever reason, we may…


Ansible_Logo

Ansible: Playbook running task based on condition

At times one may want to run certain tasks or command only if certain conditions are met. For example add a user called “RedhatUser01” only if the managed node is a Redhat node. Similarly add…


Ansible_Logo

Ansible: Run playbook looping values in variable

At times you may want to execute a single tasks with multiple variable values one after the other. For example create 3 user accounts using one task. One way is to write three tasks in the…