that is not a valid playbook, you are putting tasks in vars_prompt,
they belong in a 'tasks' section, roles also shoudl be at play level:
- name: Enter variables
hosts: localhost
gather_facts: no
vars_prompt:
- name: "vsphere_username"
prompt: "Enter vSphere Username"
private: no
- name: "vsphere_password"
prompt: "Enter vSphere Password"
- name: "vm_hostname"
prompt: "Enter Virtual Machine Hostname"
private: no
- name: "vsphere_template"
prompt: "Which application do you want to deploy?\n1- Windows
Server 2012R2\n2- Windows Server 2016\n"
private: no
- name: "java_selection"
prompt: "Which Java version do you want to deploy?\n1-
JDK1.6\n2- JDK1.7\n3- JDK1.8\n"
private: no
- name: "tomcat_selection"
prompt: "Which Tomcat version do you want to deploy?\n1-
Tomcat 7.0\n2- Tomcat 8.5\n3- Tomcat 9.0\n"
private: no
pre_tasks:
- name: "Adding virtual machine hostname to inventory"
add_host:
name: "{{ vm_hostname }}"
group:
- windows
roles:
- role: provision
vsphere_username: vsphere_username
vsphere_password: vsphere_password
vm_hostname: vm_hostname
vsphere_template: vsphere_template
Though tasks do not execute before roles, so i used a 'pre_tasks'
keyword instead.