Running ansible-playbook using Python API

Deprecation Notice: This post doesn’t work as of ansible 2. The API was changed. This covered in the Ansible documentation under “Python API.” For example, ansible -i hosts dbservers -m setup is implemented via: import ansible.runner runner = ansible.runner.Runner( module_name=”setup”, module_args=””, pattern=’dbservers’, ) dbservers_get_facts = runner.run() There are a bunch of non-documented parameters in the … Read more