Junos_config 不再适用于 ansible 2.5 python jsonDecoderError

分享于2023年04月08日 ansible json junos-automation python 问答
【问题标题】:Junos_config not working anymore with ansible 2.5 python jsonDecoderErrorJunos_config 不再适用于 ansible 2.5 python jsonDecoderError
【发布时间】:2023-04-07 20:18:01
【问题描述】:

自从我们从 ansible 2.4.3 升级到 2.5.0 后,Junos_config 因未找到与 jasonDecoderError 相关的错误而失败。在做了一些研究之后,似乎这个属性只在 python 3.5 及更高版本中受支持。我们正在运行 python 2.7.6。

但是 Ansible 2.5 仍然应该与 python 2.7 兼容,对吧?那么我们为什么会遇到这种情况呢?

谢谢,

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'JSONDecodeError'
fatal: [mx52-lab]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}


python --version
Python 2.7.6

ansible --version
ansible 2.5.0
  config file = /home/aurelien/ansible/ansible.cfg
  configured module search path = [u'/homeipa/aurelien/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]


【解决方案1】:

您为什么不喜欢使用瞻博网络支持的星系角色。您可以尝试使用 juniper_junos_config。例如:请检查

https://github.com/Juniper/ansible-junos-stdlib/blob/master/library/juniper_junos_config.py

【讨论】:

  • 感谢您的回答,现在我们可以使用核心 junos 模块,我将看看银河系,但目前我只需要了解为什么 junos_config 不再工作自从更新到 2.5...
  • 您可以在 gihub.com/Ansible/ansible 提出 GitHub 问题