Ansible tips
set_stats
must havedata
set_stats: data: failure_reason: "Duplicate."
-
Cannot loop on a
block
-
debug
cannot show up in a play, but only intasks
-
set_stats
variables cannot be used within same playbook, but only in other playbooks -
set_stats
/set_fact
cannot partially change a dictionary, the correct way is to use “combine” filter -
unless in a role,
include
/import
cannot be insidetasks
, but only outside -
import
is static,include
is dynamic -
vars
in a task is NOT recognizable in the where clause, butloop_control
var is.
vars
in a task is recognizable in theloop
clause - variable scope (e.g.
set_fact
) covers all the descendant and ancestor playbooks included.
Therefore vars in descendant/ancestor playbooks are alwasy overwritten by parent/offspringset_fact
due to precedence.