Gilles
(Gilles)
June 10, 2019, 2:45pm
1
I am using a template to run a python script. This works fine.
`
hosts: ISE
connection: local
args:
tasks:
script: /usr/bin/python3 …/scripts/ise_add.py
register: output
debug: var=output.stdout_lines
`
Now I would like to pass 2 parameters to the python script (hostname and ipaddress), either harcoded or from any file or any variable.
May I use the “extra variables” section of the template panel?
Do I have to use Jinja2?
Thanks
Regards,
Gilles
Hello,
for passing parameters to the script please see the first example on
https://docs.ansible.com/ansible/latest/modules/script_module.html#examples .
If you want to pass those parameters from variables then yes you need
to use Jinja2.
Thanks,
Martin
Gilles
(Gilles)
June 11, 2019, 7:28am
3
Hi Martin,
Thanks for the example. I would like to avoid to hardcode the parameters to be able to reuse the template. The idea was more to use variables.
I will have a look at the jinja2 side.
I may come back later if I don’t find what I am looking for.
Thanks
Gilles