我正在尝试运行一本有趣的剧本。该剧本只是在openstack环境中创建一个新服务器。我曾在其他实例和大量时间上尝试过该手册,该手册可以运行,但在当前环境下根本无法运行。
执行剧本时出现此错误:
TASK [Create vm for "{{jfmc_log_environements}}" in zhr] ***********************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "openstacksdk is required for this module"}
Ansible Command i am running is
ansible-playbook --vault-id playbooks/test/vaultpassword -i inventories/inventory playbooks/jfmc_vm_create.yaml --e groupe=test
现在,我再次检查了是否已安装openstacksdk。 Python版本也不错2.7.5。运行的Ansible版本是2.7.5
当我运行pip install openstacksdk时,说要求已经满足了。
我应该如何进行?
答案 0 :(得分:0)
尝试pip install --upgrade decorator
长话短说我正面临
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
File "/tmp/ansible_os_server_facts_payload_2j5saA/ansible_os_server_facts_payload.zip/ansible/module_utils/openstack.py", line 116, in openstack_cloud_from_module
sdk = importlib.import_module('openstack')
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/lib/python2.7/site-packages/openstack/__init__.py", line 17, in <module>
import openstack.connection
File "/usr/lib/python2.7/site-packages/openstack/connection.py", line 166, in <module>
from openstack.cloud import openstackcloud as _cloud
File "/usr/lib/python2.7/site-packages/openstack/cloud/openstackcloud.py", line 35, in <module>
import dogpile.cache
File "/usr/lib/python2.7/site-packages/dogpile/cache/__init__.py", line 1, in <module>
from .region import CacheRegion, register_backend, make_region # noqa
File "/usr/lib/python2.7/site-packages/dogpile/cache/region.py", line 15, in <module>
from decorator import decorate
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"api_timeout": null,
"auth": null,
"auth_type": null,
"availability_zone": null,
"cacert": null,
"cert": null,
"cloud": null,
"detailed": null,
"interface": "public",
"key": null,
"region_name": null,
"server": "slave-test-merrn-1",
"timeout": 180,
"verify": null,
"wait": true
}
},
"msg": "openstacksdk is required for this module"
}
基于[1]的想法,我尝试升级装饰器模块。好像实际上是旧装饰器模块的问题。错误消息具有误导性。该解决方案显然只是解决方法。还有其他地方的问题。
pip install --upgrade decorator
Collecting decorator
Downloading https://files.pythonhosted.org/packages/f1/cd/7c8240007e9716b14679bc217a1baefa4432aa30394f7e2ec40a52b1a708/decorator-4.3.2-py2.py3-none-any.whl
Installing collected packages: decorator
Found existing installation: decorator 3.4.0
Uninstalling decorator-3.4.0:
Successfully uninstalled decorator-3.4.0
Successfully installed decorator-4.3.2
答案 1 :(得分:0)
在系统上同时安装python2和python3时,会发生此问题。要解决此问题,请在
中添加以下行ansible.cfg
文件在
下[默认值]
部分。
interpreter_python = / usr / bin / python3
修改后的文件应如下所示。
[defaults]
interpreter_python = /usr/bin/python3