如何解决Ansible-RabbitMQ-即使安装了pika软件包后仍显示错误
我是ansible
和RabbitMQ
的新手。我只是从Hello World
开始。以下是我的剧本,用于读取和检索到RabbitMQ
的消息。
---
- hosts: localhost
name: "something"
vars:
ansible_python_interpreter: /usr/local/bin/python3.7
tasks:
- name: Publish a message to a queue with headers
vars:
ansible_python_interpreter: /usr/local/bin/python3.7
rabbitmq_publish:
url: "amqps://xx@roedeer.rmq.cloudamqp.com/xx"
queue: 'RunningQueue'
body: "Hello world from ansible module rabbitmq_publish"
durable: yes
content_type: "text/plain"
- name: Get 2 messages off a queue and set a fact for re-use
debug:
messages: "{{ lookup('rabbitmq',url='amqps://xx@roedeer.rmq.cloudamqp.com/xx',queue='JobQueue') }}"
执行上述剧本后。该消息正在保存在队列中,但是当我检索到该消息时,我遇到了错误。
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'rabbitmq'. Error was a <class 'ansible.errors.AnsibleError'>,original message: pika python package is required for rabbitmq lookup."}
pika
python软件包已安装在本地主机上。证明是它能够产生要排队的消息。但是我在尝试使用它时面临错误。谁能帮我这个? Google会告诉我在主机上安装pika
,但是我已经做到了。
ansible-playbook 2.8.12
config file = None
configured module search path = ['**','**']
ansible python module location = **
executable location = /usr/local/opt/ansible@2.8/bin/ansible-playbook
python version = 3.7.9 (default,Sep 9 2020,00:09:13) [Clang 11.0.0 (clang-1100.0.33.17)]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。