Use from ansible.callbacks import display rather than print so it goes through the logger and shows up in what I have configured for my log_file. You can literally change the word "print" to "display" in your code and it'll work. Display has some other neat things like coloring too if you want.
Use
from ansible.callbacks import display
rather than print so it goes through the logger and shows up in what I have configured for mylog_file
. You can literally change the word "print" to "display" in your code and it'll work. Display has some other neat things like coloring too if you want.See details here: https://github.com/ansible/ansible/blob/5ce3988d8693357f671f3fbec43b2d3b862db5f6/v1/ansible/callbacks.py#L139