Using Ansible as a Python moduleÂ
Using Ansible directly in your Python code is a powerful way of interacting with it. Please note that with Ansible 2.0 and newer, this is not the simplest of way of doing that.Â
Note
Before we proceed we should let you know what the core Ansible team thinks about using the Python API directly
From http://docs.ansible.com/ansible/latest/dev_guide/developing_api.html Please note that while we make this API available it is not intended for direct consumption, it is here for the support of the Ansible command line tools. We try not to make breaking changes but we reserve the right to do so at any time if it makes sense for the Ansible toolset. The following documentation is provided for those that still want to use the API directly, but be mindful this is not something the Ansible team supports.
The following code is from the Ansible Developer Guide documentation:Â http://docs.ansible.com/ansible/latest/dev_guide/developing_api.html:
import jsonfrom collections import...