我想创建一个剧本,提示输入多个变量并检查每个变量。以下是我要执行的操作:
- hosts: localhost
vars_prompt:
- name: "confirm_dbbackup_taken"
prompt: "Please make sure App database backup has been taken, enter 'Y' to confirm and continue"
private: no
pre_tasks:
- command: exit 1
when: confirm_dbbackup_taken != "Y"
vars_prompt:
- name: "App_server_release_package"
prompt: "Enter full path of App server release package (.tar.gz)"
private: no
roles:
- deploy_source_tree
尽管,我收到警告,但它跳过了第一个提示。
[WARNING]: While constructing a mapping from /home/Anova/boss/ansible_tutorial/deploy_anova_hosted_services_enviro
nment/deploy_anova_server/deploy_anova_server.yml, line 1, column 3, found a duplicate dict key (vars_prompt).
Using last defined value only.
Enter full path of Anova server release package (.tar.gz):
所以看起来确实不允许多个vars_prompts。 有人可以建议替代方案吗?
谢谢。