datastax / pulsar-ansible

Apache License 2.0
4 stars 9 forks source link

[ENHANCEMENT] Make roles idempotent #31

Open MMirelli opened 1 year ago

MMirelli commented 1 year ago

Idempotency is a very desirable property of ansible code. An idempotent piece of code is one that re-run multiple times would always produce the same results and side effects.

In order to ensure this in ansible, we should avoid using the following modules, whenever possible:

  1. command
  2. shell

When command or shell are essential then we can still make the module idempotent by using one or more of the following constructs:

  1. conditionals (when or assert module)
  2. other control flow statements (always, rescue or fail)

Searching and checking idempotency of roles containing command and shell is the first step.

MMirelli commented 1 year ago

No fix might be necessary, but checking for idempotency is really important.