1

What I managed to do at the moment, is to pass the parameters to the script via a configuration file.
Is it possible to pass them directly from Tower Template Survey?

The Python script is located in a SCM System.

myscript.py
config.ini
Doc
  • 133
  • 1
  • 1
  • 10

1 Answers1

-1

You can access a survey variable the same way as any variable in ansible For example Passing a password via survey Answer varaible name that you set can be used for getting value of the variable in the survey https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#create-a-survey

CRDias
  • 114
  • 3
  • Thanks for the answer, so I can access the variable in the python script as if it was an environment variable ? – Doc May 28 '20 at 22:24
  • you should be able to, I have used variable from the survey before, specifically password variable access it just like other variables `"{{ var_name }}"` where var_name is the `Answer variable name` – CRDias May 29 '20 at 01:32
  • Yes, but that would work in the Playbook, but not in the python script ! – Doc May 29 '20 at 11:24
  • 1
    Please mention the type of script in the question, I had to assume you are talking about yml script. Why not edit the script with an updated parameter using ansible before you execute it? – CRDias May 29 '20 at 15:51