3

I need a help with Ansible to run programatically. I using ansible 2.7 and trying to use Python API for calling the ansible plabooks programatically But the API from https://docs.ansible.com/ansible/latest/dev_guide/developing_api.html does not have an option to call the complete playbooks but only the tasks.

As per https://stackoverflow.com/a/35507743/269521 the api has the ability to pass the playbook path but the ansible is of older version. Can it be done similar with ansible 2.7? Anybody know how to call the entire playbook be referring the playbook path in python API?

Vijay
  • 5,331
  • 10
  • 54
  • 88
  • 4
    There is a project in github called AWX. the requirements from ansible is 2.4+ so your is fine. The AWX has API as well. Good to explore AWX first. Link: https://github.com/ansible/awx/blob/devel/INSTALL.md – error404 Apr 02 '19 at 08:56

1 Answers1

0

Ansible Runner is intended to provide a directly importable and usable API for interfacing with Ansible itself and exposes a few helper interfaces.

The modules center around the Runner object. The helper methods will either return an instance of this object which provides an interface to the results of executing the Ansible command or a tuple the actual output and error response based on the interface.

Ansible Runner itself is a wrapper around Ansible execution and so adds plugins and interfaces to the system in order to gather extra information and process/store it for use later.

bbaassssiiee
  • 6,013
  • 2
  • 42
  • 55