A common set of problems encountered when developing Ansible playbooks is the improper use or invalid assumption of the value of variables. This is particularly common when registering the results of one task in a variable and later using that variable in a task or template. If the desired element of the result is not accessed properly, the end result will be unexpected or perhaps even harmful.
To troubleshoot improper variable usage, inspection of the variable value is the key. The easiest way to inspect a variable's value is with the
debug module. The
debug module allows for displaying free form text on screen, and like with other tasks, the arguments to the module can take advantage of the Jinja2 template syntax as well. ...