# action plugin for setting vars with python vs jinja2?

**URL:** <https://forum.ansible.com/t/action-plugin-for-setting-vars-with-python-vs-jinja2/25854>\
**Category:** Ansible Developer\
**Created:** [October 28, 2017, 6:44pm UTC](https://forum.ansible.com/t/action-plugin-for-setting-vars-with-python-vs-jinja2/25854 "2017-10-28T18:44:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dswan](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dswan](https://forum.ansible.com/u/dswan)\
**Post date:** [October 28, 2017, 6:44pm UTC](https://forum.ansible.com/t/action-plugin-for-setting-vars-with-python-vs-jinja2/25854/1 "2017-10-28T18:44:48Z")

</div>

Sometimes I find myself in situations where I need to check the stdout or return code of a command executed on all hosts in a group, and based on some logical rules given the results, determine what to do next. This is sometimes clunky and error-prone to do with jinja2 and set\_fact. Consequently, I’m somewhat interested in providing a way (possibly via action plugin) to set variables by passing a function to call and arguments to pass. I have no immediate interest in integrating something like this into the core. I’m primarily looking for guidance and warnings before I try to implement this for a project I’m working on.

- Demitri
