Hi i am checking the version of python using ansible task However i am getting output value in stderr variable instead of stdout.
Here is my ansible task to check pthon version.
---
- shell: "python --version"
register: python_installed
Here is the output of the task:
changed: [172.17.0.3] => {
"changed": true,
"cmd": "python --version",
"delta": "0:00:00.259578",
"end": "2017-06-30 03:43:44.341772",
"invocation": {
"module_args": {
"_raw_params": "python --version",
"_uses_shell": true,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"warn": true
}
},
"rc": 0,
"start": "2017-06-30 03:43:44.082194",
"stderr": "Python 2.6.6",
"stderr_lines": [
"Python 2.6.6"
],
"stdout": "",
"stdout_lines": []
}
I tried to add python path in executable arguement, it also failed. I also tried using command module insted of shell module. Still failing