我是新来的。我一直在使用下面的教程来建立动态库存- https://aws.amazon.com/blogs/apn/getting-started-with-ansible-and-dynamic-amazon-ec2-inventory-management/
在运行ec2.py时,我得到了以下错误--错误:库存脚本(ec2.py)有一个执行错误:回溯(最近一次调用):文件"/etc/ansible/ec2.py",第130行,从boto导入elasticache :无法导入名称elasticache
有人能告诉我出了什么问题吗?
发布于 2015-11-08 18:32:39
看起来您需要安装boto模块。
pip install boto应该为你这么做。
发布于 2016-01-07 22:11:59
在Ubuntu上(至少在12.04),如果您通过PIP、/usr/local/lib/python2.7/dist安装python模块--其他包将不可读--它只会被根用户和staff组读取
drwxr-s--- 6 root staff 4096 Jan 7 22:04 awscli
drwxr-s--- 2 root staff 4096 Jan 7 22:04 awscli-1.9.17.dist-info
drwxr-s--- 6 root staff 4096 Dec 28 22:07 beaver
drwxr-s--- 2 root staff 4096 Dec 28 22:07 Beaver-31-py2.7.egg-info
drwxr-s--- 57 root staff 4096 Dec 28 22:07 boto
drwxr-s--- 2 root staff 4096 Dec 28 22:07 boto-2.38.0.dist-info
drwxr-s--- 5 root staff 4096 Jan 7 21:54 botocore
drwxr-s--- 2 root staff 4096 Jan 7 21:54 botocore-1.3.17.dist-info最简单的解决方案是(不对dist目录进行权限更改)将用户添加到staff组:
usermod -aG staff USERNAME发布于 2016-01-08 01:40:51
如果您从Ansible ppa安装Ansible
https://launchpad.net/~ansible/+archive/ubuntu/ansible然后使用Ubuntu中的python2.7包安装Ansible。
您需要安装python,有两种方法可以做到这一点:
python-boto包:sudo apt-get install python-botoboto (不建议这样做),因为将来从apt安装的python包与pip sudo pip install boto安装的包之间会有冲突。https://serverfault.com/questions/734809
复制相似问题