Variable Prompt under a Task

15 views
Skip to first unread message

Mohit Dhingra

unread,
Mar 13, 2018, 5:10:16 AM3/13/18
to Ansible Project
Hi All,
I want to get the variable from user. But the definition of the variable prompt has to be in the role.

I am using three actions, Lets say A,B and C. for every action(input from user) different roles will be called. But before calling respective role it should prompt the variable requirement of that role. So can we use variable prompt in a task. or any other solution for the same.

Thanks,
Mohit

Vyacheslav

unread,
Mar 13, 2018, 6:11:18 AM3/13/18
to Ansible Project
Why would not first ask, and than pass choice as an external variable to playbook?

You can ask with native shell support.

Mohit Dhingra

unread,
Mar 14, 2018, 2:17:59 AM3/14/18
to Ansible Project
But if i would first ask, It will ask all the variables that are being used in roles A, B and C.  But i want to ask first which role to use and then i want to ask the variables that are being used in selected role.

Vyacheslav

unread,
Mar 14, 2018, 4:58:35 AM3/14/18
to Ansible Project
I believe you are over-complicating things, per described.
Reply all
Reply to author
Forward
0 new messages