On Friday 18 June 2021 at 22:17:30, Jane Prusakova wrote:

> I am new to Ansible, and am trying to understand its best practices.  My
> team uses Ansible for system setup and product deployment.
> 
> I am reading that idempotance is the foundational virtue, where playbook
> idempotence is defined as not doing any state changes on consecutive runs.
> I am not sure I understand why.

For me, the reason is simple - you want to be able to run ansible multiple 
times on a given machine and be confident that the state it is left in 
afterwards is the same every time.

Suppose you have a machine which does not have a web server installed on it, 
and you have an ansible playbook which installs and configures the web server.

You want to be able to run that playbook once, and end up with a working web 
server.

You want to be able to run that smae playbook again (with no changes) and have 
the same working web server (with no changes) on the target machine.

This is partly because playbooks are often nested, so that you might have one 
for a web server and another for a mail server; you modify the one for the 
mail server but then run both of them; you want the modification you made to 
the mail server playbook to take effect but you want the web server on the 
target machine to stay just the way it was after the first run of the playbook.

> Appreciate any thoughts on why avoiding state changes on consecutive
> playbook runs is preferred over simplicity and robustness in
> implementation.

Is that a quote from somewhere?  Is there anywhere in either the ansible 
documentation or any tutorials / online guidelines you have read which say 
that "avoiding state changes on consecutive playbook runs is preferred over 
simplicity and robustness in implementation"?

Idempotence (avoiding state changes on consecutive runs) is essential.

Simplicity, and robustness in implementation, are highly desirable.

Is there a conflict between the two?


Antony.

-- 
Archaeologists have found a previously-unknown dinosaur which seems to have 
had a very large vocabulary.  They've named it The Saurus.

                                                   Please reply to the list;
                                                         please *don't* CC me.

Reply via email to