Ansible中的when语句如何使用

时间:2019-12-10 10:59:52

标签: ansible

任何人都可以检查脚本吗?我不知道为什么“何时”声明失败。

  

好:[labvMME01] => {       “味精”:[           “等待!”,           “导出的结果:/ tmp / DPE_CORE / home / jackl / ConfigFile_from_export”       ]   } ************************************************* ******************   致命的:[labvMME01]:失败! => {“ msg”:“该任务包括一个带有未定义变量的选项。错误是:'path'未定义\ n \ n错误显示为

Array
(
    [hello] => welcome 2019-12-10 11:02:11
)

1 个答案:

答案 0 :(得分:1)

请尝试以下操作。

- name: get the path of the config file
  set_fact: path="{{command_result.stdout}}"
  when: '"Exported" in command_result.stdout'