I have written a simple play book master.yml,the main function is to lookup the roles and enter one as input for second playbook. But it doesn't prompt for the variables eventhough I used var_prompt role.
--- #master.yml
- name: show roles.
hosts: nodes
connection: ssh
gather_facts: no
tasks:
- include: showroles.yml
- name: createdb and map roles.
hosts: nodes
connection: ssh
gather_facts: no
roles:
- vars_prompt_role
tasks:
- include: createdb.yml
My directory structured as following:
/playbooks/createdbandmaprole/
[user@localhost createdbandmaprole]$ ls
createdb.yml hosts master.yml roles script.sql.j2 showroles.yml
[user@localhost createdbandmaprole]$cd roles
[user@localhost roles]$ ls
var_prompt_role
[user@localhost roles]$ cd var_prompt_role/
[user@localhost var_prompt_role]$ ls
defaults handlers library main.yml meta tasks vars
[user@localhost var_prompt_role]$ vim main.yml
vars_prompt:
- name: "database"
prompt: "enter the name of database"
private: no
- name: "role"
prompt: "enter the name of role"
private: no
- name: "ad_group"
prompt: "enter the AD_Group"
private: no
[user@localhost createdbandmaprole]$ ansible-playbook master.yml -i hosts --check
but it doesn't prompt for vars