InterviewSolution
| 1. |
Explain the term “Idempotency”. |
|
Answer» For any configuration management tool, Idempotency is a key feature. Idempotency means that you can execute one or more tasks on a server any number of times and it will not make any change if it is already in the DESIRED state. Idempotency is a key feature of Ansible too. With this, Ansible makes sure that it doesn’t make unnecessary changes on managed hosts. THINK of automating a task using scripts and automating the same task using Ansible. If you run a script to perform a task, it will perform required steps on each and every execution of the script, on the other hand, Ansible will make changes only once, even though you execute it a THOUSAND times. Why idempotency is required? So, let's understand it with an example: suppose you need to append a LINE “this is a test” to a file and you created a script for this. Now, WHENEVER you run this script it will append the same line again and again ( until you are smart enough to include an existence test in the script ). With Ansible, you just write to append line in a file and then Ansible automatically checks, if it is already there or not. |
|