我无法用Ansible换句话

问题描述 投票:0回答:1

我有以下问题。我正在Ansible中创建一个用于安装OCSInventory的剧本,在执行脚本时,交互开始定义某些参数,为此,我使用了Expect模块,在这些问题中,特别是有一个我无法成功创建的问题逃脱角色,然后我分享信息。

尽管最初它们使用单​​引号,但您必须根据ansible日志传递的消息来分配双引号enter image description here

'为了确保Apache在OCS Inventory NG Communication Server之前加载mod_perl,安装程序可以将Communication Server Apache配置文件命名为““ z-ocsinventory-server.conf”“,而不是” ocsinventory-server.conf“”。您是否允许安装程序将Communication Server Apache配置文件重命名为““ z-ocsinventory-server.conf”“([y] / n)\?':''

这是错误,如果有人可以给我一些建议,我尝试了不同的方法,但没有结果。enter image description here

  "+----------------------------------------------------------------------+", 
    "|     OK, Communication server plugins Perl directory created ;-)      |", 
    "|                                                                      |", 
    "|               Now configuring Apache web server...                   |", 
    "+----------------------------------------------------------------------+", 
    "", 
    "To ensure Apache loads mod_perl before OCS Inventory NG Communication Server,", 
    "Setup can name Communication Server Apache configuration file", 
    "'z-ocsinventory-server.conf' instead of 'ocsinventory-server.conf'.", 
    "Do you allow Setup renaming Communication Server Apache configuration file", 
    "to 'z-ocsinventory-server.conf' ([y]/n) ?"
ansible
1个回答
0
投票

您可以使用查找插件将棘手的文本加载到变量中。

vars:
  prompt: '{{ lookup("file", "tricky_prompt.txt") }}'

将要加载的文本保存到files/tricky_prompt.txt

不仅仅是在需要文本的地方使用变量prompt

© www.soinside.com 2019 - 2024. All rights reserved.