Ansible-RabbitMQ-即使安装了pika软件包后仍显示错误

问题描述

我是ansibleRabbitMQ的新手。我只是从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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...