[TriPython] Ansible and Python
Art
artem.nesterenko at gmail.com
Thu Jan 24 16:44:59 EST 2019
Hi guys!
I have a quick question for those who have experience in Ansible. I've went
through multiple resources, but it didn't really help.
I'm using ansible 2.6.4 and python 2.6.6. I have a small working example of
an ansible playbook:
https://github.com/ArtyomMinsk/ansible_playground/blob/master/python_version.yml
where in the first task (line 7) I store the output in the declared
variable (line 9) and then in the second task (line 11) I parse the value
of that variable (string), do the checking and if True then execute the
task (line 13).
Is there a way I can pass the value of that variable to custom python
script, do the parsing like:
def get_python_version(output):
return output.split(" ")[-1]
and then somehow return the result back to ansible playbook task and do the
version checking?
If someone can refer me to a good example that would be great.
Thank you!
Art Nestsiarenka
email: artem.nesterenko at gmail.com
-------------- next part --------------
Hi guys!
I have a quick question**for those who have experience in Ansible. I've
went through multiple resources, but it didn't really help.
I'm using ansible 2.6.4 and python 2.6.6. I have a small working example
of an ansible playbook:
[1]https://github.com/ArtyomMinsk/ansible_playground/blob/master/python_version.yml
where in the first task (line 7)**I store the output in the declared
variable (line 9)**and then in the second task (line 11)**I parse the
value of that variable (string), do the**checking and if True then execute
the task (line 13).**
Is there a way I can pass the value of that variable to custom python
script, do the parsing like:
def get_python_version(output):
****** return output.split(" ")[-1]
and then somehow**return the result back to ansible playbook task and do
the version checking?
If someone can refer me to a good example that would be great.
Thank you!
Art Nestsiarenka
email: [2]artem.nesterenko at gmail.com
References
Visible links
1. https://github.com/ArtyomMinsk/ansible_playground/blob/master/python_version.yml
2. mailto:artem.nesterenko at gmail.com
More information about the TriZPUG
mailing list