To debug (using print statements), one has 2 options
- The module files are located inside
ansible/module_utils/module_name/
ie:ansible/module_utils/k8s/
- The parameters given to a specific task are stored in the
self.params
self.params
gets the values assigned outside the module (from the Module System)- Adding any print statements, will result in the task failing, so after debugging ensure no prints are still existent
- The module systems files are located in
ansible/module_utils/
(ie:basic.py
) andansible/module_utils/system/
(ie:setup.py
) - Modifying those files won't help at all, as they will
- Fail the task with the message
The following modules failed to execute: setup
- Avoid from reaching the other non-system debug points.
In my debugging session, I used from_yaml_all
filter, instead of from_yaml_all | list
which resulted in the resource_definition
param being the generator object's string, thus I got the error described in this issue.
The use of list
filter forces the from_yaml_all
to return the output as a list, that can be justified by the fact that ansible is written in Python, and it depends on the output of yaml.load_all()
which should be loaded with list()
, following this answer.
- Jinja whitespace templating could be further controlled based on this SO Answer.