Ich habe ein einfaches Spielbuch master.yml geschrieben, die Hauptfunktion besteht darin, die Rollen zu suchen und eine als Eingabe für das zweite Playbook einzugeben. Aber es fragt nicht nach den Variablen, obwohl ich die Rolle var_prompt verwendet habe.Kann var_prompt in einer Rolle enthalten sein?
--- #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
Meine Auswahl wie folgt strukturiert:
/playbooks/createdbandmaprole/
[[email protected] createdbandmaprole]$ ls
createdb.yml hosts master.yml roles script.sql.j2 showroles.yml
[[email protected] createdbandmaprole]$cd roles
[[email protected] roles]$ ls
var_prompt_role
[[email protected] roles]$ cd var_prompt_role/
[[email protected] var_prompt_role]$ ls
defaults handlers library main.yml meta tasks vars
[[email protected] 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
[[email protected] createdbandmaprole]$ ansible-playbook master.yml -i hosts --check
fordert aber nicht für Vars
Wie bezieht sich die Frage im Titel auf den Inhalt? – techraf