Runtime Error from Juniper.junos role

192 views
Skip to first unread message

Daniel Ratcliffe

unread,
Apr 11, 2017, 8:59:54 AM4/11/17
to Ansible Project
Hello,

I installed Ansible(2.2.1.0), the Juniper.junos(1.4.0) role from Ansible galaxy with junos-eznc (2.1.1). I tried to create a test playbook to obtain the version of my test switch as shown below.

---
- name: Get Device Facts
  hosts: juniper
  roles:
    - Juniper.junos
  connection: local
  gather_facts: no
  tasks:
    - name: Checking NETCONF connectivity
      wait_for: host={{ inventory_hostname }} port=830 timeout=5

    - name: Get Facts
      junos_get_facts:
        host={{ inventory_hostname }}
        savedir=/home/dratcliffe/ansible
      register: junos

    - name: Show Version
      debug: msg="{{ junos.facts.version }}" 

when I run the playback I get the following error.

[user@ansible ~]$ ansible-playbook test.yml

PLAY [Get Device Facts] ********************************************************

TASK [Checking NETCONF connectivity] *******************************************
ok: [X.X.X.X]

TASK [Get Facts] ***************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: RuntimeError: facts are read-only!
fatal: [X.X.X.X]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_SkXS6C/ansible_module_junos_get_facts.py\", line 235, in <module>\n    main()\n  File \"/tmp/ansible_SkXS6C/ansible_module_junos_get_facts.py\", line 176, in main\n    dev.facts['has_2RE'] = dev.facts['2RE']\n  File \"/usr/lib/python2.7/site-packages/jnpr/junos/factcache.py\", line 171, in __setitem__\n    raise RuntimeError(\"facts are read-only!\")\nRuntimeError: facts are read-only!\n", "module_stdout": "", "msg": "MODULE FAILURE"}
to retry, use: --limit @/home/dratcliffe/test.retry

PLAY RECAP *********************************************************************
X.X.X.X              : ok=1    changed=0    unreachable=0    failed=1   


It seems when it gets the facts it tried to write something and I get an error saying it is read-only? Has anyone encountered this?

Daniel Ratcliffe

unread,
Apr 11, 2017, 12:19:44 PM4/11/17
to Ansible Project
I've resolved this. There was an update made to junos-eznc that broke the version of Juniper-junos on Ansible-Galaxy. I had to pull a more recent version from the git repo.

Daniel

MYN

unread,
Apr 17, 2017, 3:05:38 PM4/17/17
to Ansible Project
Hi Daniel,

Would you please share how did you upgrade? I am also getting similar error.



"TASK [GET-MODEL] ***************************************************************
fatal: [192.168.56.103]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV\n  self._cipher = factory.new(key, *args, **kwargs)\nTraceback (most recent call last):\n  File \"/home/yasir/.ansible/tmp/ansible-tmp-1492337992.22-261119891504603/junos_get_facts\", line 2168, in <module>\n    main()\n  File \"/home/yasir/.ansible/tmp/ansible-tmp-1492337992.22-261119891504603/junos_get_facts\", line 176, in main\n    dev.facts['has_2RE'] = dev.facts['2RE']\n  File \"/usr/local/lib/python2.7/dist-packages/jnpr/junos/factcache.py\", line 171, in __setitem__\n    raise RuntimeError(\"facts are read-only!\")\nRuntimeError: facts are read-only!\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}

PLAY RECAP *********************************************************************
192.168.56.103             : ok=0    changed=0    unreachable=0    failed=1  "




Thanks,

MYN
Reply all
Reply to author
Forward
0 new messages