python - 使用 ansible-runner 作为 Python 模块接口到 Ansible 错误:RunnerConfig' 对象没有属性 'command'
问题描述
我使用 ansible 2.9.13 和 ansible-runner 1.4.6
下面是我的 Python 代码:
from ansible_runner import Runner, RunnerConfig
f = open('/home/george/dev/beeops/ansible_private/keyfile', 'r')
key = f.read()
rc = RunnerConfig(private_data_dir='/home/george/dev/beeops/ansible_private',
playbook='test.yml',
inventory='127.0.0.1',
ssh_key=key,)
r = Runner(config=rc)
r.run()
执行这段代码时出错,</p>
File "/home/george/venv/bops/lib/python3.7/site-packages/ansible_runner/runner.py", line 114, in run
command = self.config.command
AttributeError: 'RunnerConfig' object has no attribute 'command'
有人可以帮我看看是什么问题吗?感谢所有回复的朋友!
解决方案
推荐阅读
- python - CPP 中的 WSGI 服务器
- javascript - React Router goBack 在 buttonclick 上不起作用
- java - 在枚举中声明一个可变集合(例如列表)是一种好习惯吗?
- python - 如何使用 AraVec 模型获取词嵌入并建立文本分类模型?
- java - 如何将 SpringBoot 配置外部文件覆盖到类路径文件?
- node.js - 从“.cer”文件中读取 Node.js 中 RSA/ECB/OAEPWithSHA-256AndMGF1Padding 的公钥
- javascript - 我试图在javascript中比较两个变量
- java-8 - Java 8 从 ArrayList 错误中获取不同的元素
- node.js - Windows:使用 nodejs 创建的文件夹 - Windows 说位置不可用
- assembly - 在nasm中乘然后除