I tried to setup Ansible using Python API from the following site.
https://serversforhackers.com/c/running-ansible-2-programmatically
The question at hand is as follows: How to alter verbosity programmatically in ansible. The codes below seems to not work to adjust the verbosity of the output.
# Set global verbosity
self.display = Display()
self.display.verbosity = self.options.verbosity
# Executor appears to have it's own
# verbosity object/setting as well
playbook_executor.verbosity = self.options.verbosity
It has been pretty successful (ansible 2.3.0) thus far except verbosity settings. As the codes are in the website, I'll not post my codes here since it is exactly the same. I have tried to check the source code of ansible but it seems to be quite difficult to look through how the options are used. (i looked at display.py, playbook_executor.py, play_context.py, etc...)
note: for users who use the same code, please set the skip_tags and tags to '' for it to work in versions > 2.2.0.