由于我们从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]
答案 0 :(得分:0)
为什么不喜欢使用支持juniper的galaxy角色?您可以尝试使用juniper_junos_config。例如:请检查
https://github.com/Juniper/ansible-junos-stdlib/blob/master/library/juniper_junos_config.py