Pip python脚本输出在ansible变量中

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

我写了一个python脚本。当我在命令行中运行该python脚本时:python file.py我得到的输出为My name is sovith。现在,我写了一个运行python脚本的ansible剧本。我想将python脚本输出存储在ansible变量中,并在以后的播放中使用它。谁能告诉我该怎么做?

python python-3.x ansible ansible-2.x
1个回答
0
投票

就像任何模块的输出一样,您可以注册该变量并在以后引用它。

这里是文档:https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#registering-variables

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