Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know what version of Jinja2 my ansible is using?

Tags:

ansible

jinja2

I tried to use pip list and pip freeze without success.
It might be something obvious but I am not able to find it so far.

like image 623
giglemad Avatar asked Feb 28 '18 22:02

giglemad


1 Answers

Drop this file as ./action_plugins/jin_ver.py:

from ansible.plugins.action import ActionBase
import jinja2


class ActionModule(ActionBase):

    def run(self, tmp=None, task_vars=None):
        result = super(ActionModule, self).run(tmp, task_vars)
        return dict(msg=jinja2.__version__)

And execute this playbook ./test_jin.yaml:

---
- hosts: localhost
  gather_facts: no
  tasks:
    - action: jin_ver

You should see something like this:

$ ansible-playbook test_jin.yaml -v
TASK [jin_ver] *****************************************
ok: [localhost] => {"changed": false, "msg": "2.8"}
like image 197
Konstantin Suvorov Avatar answered Oct 01 '22 06:10

Konstantin Suvorov