emm,获取ansible的host文件,总是提示我找不到文件?

来源:7-3 InventoryManager调用

慕妹7162846

2018-07-01

我的目录结构

wentaodeMacBook-Pro:ansible_api_demo wentao$ tree 

.

├── all

└── bin.py

执行的代码;

inventory = InventoryManager(loader=DataLoader,sources=['/Users/wentao/PycharmProject/ansible_api_demo/all'])

无论是用绝对路径还是相对路径都不可以执行

 [WARNING]:  * Failed to parse /Users/wentao/PycharmProject/ansible_api_demo/all with yaml plugin: get_basedir() missing 1 required positional argument: 'self'


 [WARNING]:  * Failed to parse /Users/wentao/PycharmProject/ansible_api_demo/all with ini plugin: get_basedir() missing 1 required positional argument: 'self'


 [WARNING]: Unable to parse /Users/wentao/PycharmProject/ansible_api_demo/all as an inventory source


 [WARNING]: No inventory was parsed, only implicit localhost is available


写回答

1回答

慕妹7162846

提问者

2018-07-01

问题解决了,

忘记实例化 DataLoader()

0
0

Python+Django+Ansible Playbook自动化运维项目实战

【课程升级3.6版本】大牛全面践行DevOps,运维与开发间高效协作

861 学习 · 326 问题

查看课程