ansible - [警告]:模块 snow_record 未在:/usr/share/my_modules:/usr/lib/python2.7/site-packages/ansible/modules
问题描述
当我在剧本中使用 snow_record 时,我得到以下错误。请帮忙。
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
tasks:
- name: calling variable which has user/pass
include_vars: /ansible/pass.yml
- name: read from snow
snow_record_find:
username: "{{ snow_username }}"
password: "{{ snow_password }}"
instance: mycompany
state: present
table: incident
query:
assignment_group: unix-support
return_fields:
- number
register: host_list
# ansible-doc snow_record
[WARNING]: module snow_record not found in: /usr/share/my_modules:/usr/lib/python2.7/site-packages/ansible/modules
ansible 2.4.2.0
config file = /home/m0156751/ansible/ansible.cfg
configured module search path = [u'/usr/share/my_modules']
ansible python module location - /usr/lib/python2.7/site-packages/ansible
executable location - /usr/bin/ansible
python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
解决方案
您正在使用旧版本的 ansible (2.4.2),其中服务现在模块不存在 ( https://docs.ansible.com/ansible/2.4/list_of_all_modules.html )。
您需要升级到 2.5 才能获得该snow_record
模块。
但是对于snow_record_find
你需要升级到2.9。
从那时起,该模块是 servicenow 集合的一部分:https ://galaxy.ansible.com/servicenow/servicenow
除了拥有正确版本的 ansible 之外,这个特定的模块还有一些要求(https://docs.ansible.com/ansible/2.9/modules/snow_record_find_module.html#requirements):您需要pysnow
在模块执行的目标主机。您可以在使用 service now 模块之前的任务中通过pip
或package
(如果 pysnow 作为系统包提供)模块来执行此操作。
推荐阅读
- php - 为什么这个 next_page_link 不能正常工作?
- php - 函数调用返回数组输出的第一个字符
- javascript - 如何使用 OOP JavaScript 重复一个函数
- doxygen - 将 Doxygen 函数与命名空间一起提取到 .csv 文件中
- c++ - 将右值分配给右值
- python - 使用循环从列表中查找最高分、最低分
- windows - VBS 对象需要错误处理字符串
- python - 无法使用 End At 使用 Python 搜索 Firebase 管理员
- python-3.x - python请求的正则表达式
- javascript - Reactjs 在对象的键上创建自定义数据属性