【发布时间】:2023-04-08 08:45:01
【问题描述】:
在下面的假设示例中,我通过 shell 模块在远程主机上执行 sleep 5 秒。如果远程 shell 进程没有返回,我希望 Ansible Runner 在四秒后超时。这可能吗?
r = ansible_runner.run(inventory=ansible_inventory, host_pattern="all",
module="shell",
module_args=("sleep 5"),
envvars = {
"ansible_command_timeout": 4 # This doesn't seem to work
}
)
【问题讨论】:
-
试试这个:创建private_data_dir并将其添加到参数中。将
timeout: 4放入私有目录的env/settings文件中。
标签: python ansible ansible-runner