小编cur*_*usY的帖子

如何从Ansible python playbook api获取远程stdout

我知道我可以使用debugAnsible模块打印出std,如下所示:

---
- hosts: all
  tasks:
  - name: list files under /root folder
    command: ls /root
    register: out

  - name: stdout
    debug: var=out.stdout_lines
Run Code Online (Sandbox Code Playgroud)

如何使用Ansible 2.0 Python API来运行Playbook的答案,我可以用python代码运行Ansible playbook.

所以问题是如何out使用Ansible python api 获取此剧本中变量的内容?

python ansible ansible-playbook ansible-2.x

1
推荐指数
1
解决办法
2838
查看次数

标签 统计

ansible ×1

ansible-2.x ×1

ansible-playbook ×1

python ×1