在Django中,如何通过WebSocket将ansible_runner的输出传递到页面?

huangapple go评论63阅读模式
英文:

In django, how can I pass the output of ansible_runner to the page through websocket?

问题

我想实时在页面上显示类似以下的输出,或在捕获后保存到数据库。我认为ansible_runner应该有这样的接口,但我找不到它。

2023年5月30日星期二  08:45:30 +0800 (0:00:00.059)       0:00:00.059 *********** 
12.212.212.22 | 成功 => {
    "ansible_facts": {
        "ansible_memfree_mb": 258388,
        "ansible_memtotal_mb": 515659,
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false
}
2023年5月30日星期二  08:45:33 +0800 (0:00:02.731)       0:00:02.790 *********** 
=============================================================================== 
setup ------------------------------------------------------------------- 2.73秒
英文:

I want to display the output similar to the following on the page in real time, or save it to the database after being captured. I think ansible_runner should have such an interface, but I can't find it

Tuesday 30 May 2023  08:45:30 +0800 (0:00:00.059)       0:00:00.059 *********** 
12.212.212.22 | SUCCESS => {
    "ansible_facts": {
        "ansible_memfree_mb": 258388,
        "ansible_memtotal_mb": 515659,
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false
}
Tuesday 30 May 2023  08:45:33 +0800 (0:00:02.731)       0:00:02.790 *********** 
=============================================================================== 
setup ------------------------------------------------------------------- 2.73s

答案1

得分: 2

A: ansible-runner 在被捕获后会创建持久化的文档。可以将这些文档视为您可能想要解析的数据库。请参阅示例

英文:

Q: "I want to save the output to a database after being captured."

A: ansible-runner creates persistent artifacts. Consider the artifacts a database you might want to parse. See the example.

huangapple
  • 本文由 发表于 2023年5月30日 09:28:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76361094.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定