In the following playbook, i have prompts to capture certain information. The created variables work fine in the first set of tasks in the playbook. However, they don’t carry over into the second set of tasks in the playbook, based on what I’ve tried (as seen in the playbook, which is probably not the most efficient). Is there a way to do this?
I think the vars from vars_prompt are tied to localhost in the first play, so if you need them in any next plays, you would need to reference them as localhost’s hostvars:
Dick, I’m not getting that to work. For now, I’m prompting again for the pemno withing the second set of tasks. That works, but isn’t ideal. I’d like to see if I can “re-use” the pemno gathered from the first tasks prompt in the second set of tasks:
- hosts: localhost connection: local gather_facts: false
vars_prompt: - name: “pemno” prompt: “Enter the number of the created pems” private: no