ansible - 稳定 | 错误!任务中未检测到任何操作。这通常表示模块名称拼写错误或模块路径不正确
问题描述
下面是 Ansible 脚本,它将删除现有的 Zip 文件(如果存在),使用 python 命令生成 src html 文件,生成 html 文件后,脚本将压缩它们:-
---
- name: run playbook locally
hosts: 127.0.0.1
connection: local
become: yes
gather_facts: yes
tasks:
- name: "CODE | PyDoc | Delete Zip"
file:
path: "{{ code_source_dev }}/doc/pydoc.zip"
state: absent
- name: CODE | Doc | Generating src html documents
shell: "python -m pydoc -w src/*.py"
ignore_errors: yes
args:
chdir: "{{ code_source_dev }}"
executable: /bin/bash
- name: CODE | Doc | Generating injectionModules html documents
shell: "python -m pydoc -w injectionModules/*.py"
ignore_errors: yes
args:
chdir: "{{ code_source_dev }}"
executable: /bin/bash
- name: CODE | Doc | Generating Test cases html documents
shell: "python -m pydoc -w test/template_unit_test_framework.py"
ignore_errors: yes
args:
chdir: "{{ code_source_dev }}"
executable: /bin/bash
- name: CODE | Doc | Zip html documents
shell: "zip -r code-pydoc/pydoc.zip *.html"
ignore_errors: yes
args:
chdir: "{{ code_source_dev }}"
executable: /bin/bash
Ansible 命令:-
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -K acm/plays/emr/pydocs.yml
从 Jenkins 执行后出现以下错误日志:-
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/data/jenkins/workspace/cng-tesie-master-ci/acm/plays/emr/pydocs.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: run playbook locally
^ here
使用的 Ansible 版本:-
+ ansible-playbook --version
ansible-playbook 2.7.5
config file = None
configured module search path = [u'/home/ec2-user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
解决方案
播放规范没有“名称”字段。所以这是错误的:
- name: run playbook locally
hosts: 127.0.0.1
connection: local
become: yes
gather_facts: yes
tasks:
它应该看起来像这样:
- hosts: 127.0.0.1
connection: local
become: yes
gather_facts: yes
tasks:
推荐阅读
- python-3.x - Python Selenium find_element_by_xpath
- node.js - 在spring-boot中使用Outh服务器uri验证nodejs资源服务器中的访问令牌
- python - reStructuredText 文档字符串中的多个返回值(Python 3)
- html - height 在 Chrome 77 上似乎无法正常工作
- javascript - 动态参数ngrx选择器
- java - 满足基本情况时执行以下语句
- python - TensorFlow EOFError:压缩文件在到达流结束标记之前结束
- javascript - JS ES6:如何让子方法访问他们的兄弟姐妹?
- python - “BinarySearch 字符串和整数错误”中的错误
- java - HttpMediaTypeNotAcceptableException:找不到可接受的表示