Ansible归档模块“;在“任务”中未检测到任何操作;

Ansible归档模块“;在“任务”中未检测到任何操作;,ansible,ansible-playbook,ansible-2.x,Ansible,Ansible Playbook,Ansible 2.x,我想使用ansible的归档模块,但不幸的是它不起作用。我安装了以下版本:ansible 2.3.0(devel 2131eaba0c) 我的剧本是这样的: - archive: path="{{path_dir}}" dest="{{dest_dir}}/foo.zip" format=zip "failed": true, "reason": "no action detected in task. This often indicates a misspelled module name

我想使用ansible的归档模块,但不幸的是它不起作用。我安装了以下版本:ansible 2.3.0(devel 2131eaba0c)

我的剧本是这样的:

- archive: path="{{path_dir}}" dest="{{dest_dir}}/foo.zip" format=zip
"failed": true, "reason": "no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/prj/sndbox1/app/jenkins/jobs/release/workspace/tasks/build_rpclient.yml': line 125, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:

- archive: path="{{path_dir}}" dest="{{dest_dir}}/foo.zip" format=zip
  ^ here
We could be wrong, but this one looks like it might be an issue with missing quotes.  Always quote template expression brackets when they start a value. For instance:
    with_items:
     - {{ foo }}
Should be written as:
    with_items:
     - "{{ foo }}"
输出如下所示:

- archive: path="{{path_dir}}" dest="{{dest_dir}}/foo.zip" format=zip
"failed": true, "reason": "no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/prj/sndbox1/app/jenkins/jobs/release/workspace/tasks/build_rpclient.yml': line 125, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:

- archive: path="{{path_dir}}" dest="{{dest_dir}}/foo.zip" format=zip
  ^ here
We could be wrong, but this one looks like it might be an issue with missing quotes.  Always quote template expression brackets when they start a value. For instance:
    with_items:
     - {{ foo }}
Should be written as:
    with_items:
     - "{{ foo }}"
据我所知,额外的模块在ansible中提供,因此我假设不需要单独安装此模块

然而,我做错了什么?为了告诉ansible在哪里寻找额外的模块,我是否需要更改任何配置

提前谢谢

编辑:包含完整日志消息

编辑2:

我试图将archive.py直接放入我的工作目录-->[library]/archive.py

现在我得到以下错误:

"failed": true, "msg": "Could not find imported module support code for archive.  Looked for either get_exception or pycompat24"

我在这里有相同的用例,我使用的是Ansible版本2.2.0.0。在MacOS sierra上通过brew安装

通过将以下内容添加到本地ansible.cfg文件中,我成功地解决了这个问题

在defautls部分,必须更改库条目:

[默认值]
library=/usr/local/ceral/ansible/2.2.0.0_2/libexec/lib/python2.7:库

如果您有不同的设置,请检查:

  • pip show ansible
  • /usr/share/ansible
    如果您在Linux机器上

  • 这是完整的剧本吗?什么是完整的错误消息?我插入了完整的日志消息。playbook还包含其他任务,但它在没有此任务的情况下也可以工作,因此我认为playbook的其余部分应该是OK的。我做了一些测试,结果显示,即使在2.1.2.0中,存档也不再随ansible一起提供。我检查了我的附加模块,没有在那里看到它。你需要从ansible git回购中获取它,并根据需要将其放在你的剧本/角色中。你确定吗?我可能错了,但模块:/ansible/lib/ansible/modules/extras/files/archive.py对于您的ansible安装来说,这不是一个非常奇怪的目录吗。这是Python2.7安装中的一个子路径吗?