# Thoughts on Ansible as an AP

**URL:** <https://forum.ansible.com/t/thoughts-on-ansible-as-an-ap/15583>\
**Category:** Ansible Developer\
**Created:** [July 1, 2014, 12:17pm UTC](https://forum.ansible.com/t/thoughts-on-ansible-as-an-ap/15583 "2014-07-01T12:17:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![willthames](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@willthames](https://forum.ansible.com/u/willthames)\
**Post date:** [July 1, 2014, 12:17pm UTC](https://forum.ansible.com/t/thoughts-on-ansible-as-an-ap/15583/1 "2014-07-01T12:17:41Z")

</div>

I’ve been doing a bit of work with using Ansible as an API recently, and there are a few minor gaps.

For example I believe the on\_ok and on\_failed calls from \_run\_task could be passed the name of the task  
The completion of a playbook has no associated callback.

It would also be nice to customize what Playbook.run() returns (perhaps a future on\_complete could compile the results to return) - sure, stats.summarize might be what you want for some jobs, other times you might just want the concatenation of all the standard out, for example.

I guess my question for here is if I did some tidying in these areas such that ansible-playbook and ansible still work, and the tests all pass, would it be integrated at some point in future?

Will

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 1, 2014, 1:44pm UTC](https://forum.ansible.com/t/thoughts-on-ansible-as-an-ap/15583/2 "2014-07-01T13:44:49Z")

</div>

Hi Will,

the API is designed to serve the needs of /usr/bin/ansible and /usr/bin/ansible-playbook, and it’s very important that we keep the API signatures of all the callback plugins operational.

I’m not positive the things you say are gaps - The task name, for instance, is already set on the callback object so it’s accessible.

If folks want to concatenate all the stdout (seems a bit arbitrary, but fine if you want), that sounds like a great place for a custom callback plugin.

For those that want a really sweet REST way to call into the system and introspect recorded (and running) job results, I’d also suggest looking at Ansible Tower. [http://www.ansible.com/tower](http://www.ansible.com/tower)
