# Problems updating Junos configuration with new modules/versions

**URL:** <https://forum.ansible.com/t/problems-updating-junos-configuration-with-new-modules-versions/24834>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [June 27, 2017, 8:54pm UTC](https://forum.ansible.com/t/problems-updating-junos-configuration-with-new-modules-versions/24834 "2017-06-27T20:54:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siegfried](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@Siegfried](https://forum.ansible.com/u/Siegfried)\
**Post date:** [June 27, 2017, 8:54pm UTC](https://forum.ansible.com/t/problems-updating-junos-configuration-with-new-modules-versions/24834/1 "2017-06-27T20:54:56Z")

</div>

Hi,

I had been using the Juniper.junos modules from Ansible Galaxy successfully for a while now, but had been asked to update my python environment to corporate standards through Conda, which included newer versions of most modules. Ever since the update, I have been unable to use either the native junos\_config module, nor the old junos\_install\_config. The junos\_install\_config now complains about the following, using that the exact same configuration files as before:

/private/etc/ansible/roles/Juniper.junos/library/junos\_install\_config:198: SyntaxWarning: import \* only allowed at module level  
def \_load\_via\_netconf(module):

{“msg”: “Error: Module unable to decode valid JSON on stdin. Unable to figure out what parameters were passed”, “failed”: true}

Because of that error, I decided that I might as well update the playbooks to use the new native modules instead. However, when I try to push the configuration, he’re the output I get:

TASK [Pushing config … please wait] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [switch]: FAILED! =\> {“changed”: false, “failed”: true, “msg”: “one of candidate or rollback must be specified”}

I looked a bit at the code to find what was candidate variable and as I expected, it seems to point to what src is. I’ve also validated through debug that the path is valid, so I really have no idea where to look afterwards.

Here’s the playbook:

- name: Apply configuration  
hosts: all  
connection: local  
gather\_facts: no  
vars:  
junos\_creds:  
username: “{{ ansible\_ssh\_user }}”  
host: “{{ ansible\_ssh\_host }}”  
port: “{{ netconf\_port }}”  
tasks:
- name: Pushing config … please wait  
when: config\_changed is defined  
junos\_config: \>  
provider: “{{ junos\_creds }}”  
src: {{ junos\_conf }}  
update: override  
comment: Test pushed by ansible

Here’s the detailed debug:

29707 1498596207.19598: ANSIBALLZ: Using lock for junos\_config  
29707 1498596207.19683: ANSIBALLZ: Acquiring lock  
29707 1498596207.19731: ANSIBALLZ: Lock acquired: 4405365776  
29707 1498596207.19772: ANSIBALLZ: Creating module  
29707 1498596207.33891: ANSIBALLZ: Writing module  
29707 1498596207.33985: ANSIBALLZ: Renaming module  
29707 1498596207.34068: ANSIBALLZ: Done creating module  
29707 1498596207.34157: \_low\_level\_execute\_command(): starting  
29707 1498596207.34187: \_low\_level\_execute\_command(): executing: /bin/sh -c ‘echo ~ && sleep 0’  
29707 1498596207.34226: in local.exec\_command()  
29707 1498596207.34252: opening command with Popen()  
29707 1498596207.34696: done running command with Popen()  
29707 1498596207.34801: getting output with communicate()  
29707 1498596207.35497: done communicating  
29707 1498596207.35543: done with local.exec\_command()  
29707 1498596207.35586: \_low\_level\_execute\_command() done: rc=0, stdout=/Users/user  
, stderr=  
29707 1498596207.35624: \_low\_level\_execute\_command(): starting  
29707 1498596207.35659: \_low\_level\_execute\_command(): executing: /bin/sh -c ‘( umask 77 && mkdir -p “`echo /Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708`” && echo ansible-tmp-1498596207.34-16034423383708=“`echo /Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708`” ) && sleep 0’  
29707 1498596207.35716: in local.exec\_command()  
29707 1498596207.35778: opening command with Popen()  
29707 1498596207.36368: done running command with Popen()  
29707 1498596207.36466: getting output with communicate()  
29707 1498596207.38038: done communicating  
29707 1498596207.38113: done with local.exec\_command()  
29707 1498596207.38160: \_low\_level\_execute\_command() done: rc=0, stdout=ansible-tmp-1498596207.34-16034423383708=/Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708  
, stderr=  
29707 1498596207.38197: transferring module to remote /Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708/junos\_config.py  
29707 1498596207.38477: done transferring module to remote  
29707 1498596207.38530: \_low\_level\_execute\_command(): starting  
29707 1498596207.38557: \_low\_level\_execute\_command(): executing: /bin/sh -c ‘chmod u+x /Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708/ /Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708/junos\_config.py && sleep 0’  
29707 1498596207.38585: in local.exec\_command()  
29707 1498596207.38614: opening command with Popen()  
29707 1498596207.39066: done running command with Popen()  
29707 1498596207.39149: getting output with communicate()  
29707 1498596207.39983: done communicating  
29707 1498596207.40043: done with local.exec\_command()  
29707 1498596207.40103: \_low\_level\_execute\_command() done: rc=0, stdout=, stderr=  
29707 1498596207.40145: \_low\_level\_execute\_command(): starting  
29707 1498596207.40182: \_low\_level\_execute\_command(): executing: /bin/sh -c ‘/usr/bin/python /Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708/junos\_config.py; rm -rf “/Users/user/.ansible/tmp/ansible-tmp-1498596207.34-16034423383708/” \> /dev/null 2\>&1 && sleep 0’  
29707 1498596207.40217: in local.exec\_command()  
29707 1498596207.40243: opening command with Popen()  
29707 1498596207.40679: done running command with Popen()  
29707 1498596207.40873: getting output with communicate()  
29707 1498596208.35579: done communicating  
29707 1498596208.35621: done with local.exec\_command()  
29707 1498596208.35658: \_low\_level\_execute\_command() done: rc=0, stdout=  
{“msg”: “one of candidate or rollback must be specified”, “failed”: true, “invocation”: {“module\_args”: {“comment”: “configured by junos\_config”, “src”: null, “ssh\_keyfile”: null, “rollback”: null, “timeout”: 10, “confirm”: 0, “lines”: null, “update”: “merge”, “replace”: null, “username”: null, “host”: null, “zeroize”: false, “src\_format”: null, “provider”: null, “password”: null, “backup”: false, “port”: null, “transport”: null}}}  
, stderr=  
29707 1498596208.35703: done with \_execute\_module (junos\_config, {‘\_ansible\_version’: ‘2.3.1.0’, ‘\_ansible\_selinux\_special\_fs’: [u’fuse’, u’nfs’, u’vboxsf’, u’ramfs’, u’9p’], ‘\_ansible\_no\_log’: False, ‘\_ansible\_module\_name’: u’junos\_config’, ‘\_ansible\_verbosity’: 0, ‘\_ansible\_syslog\_facility’: u’LOG\_USER’, ‘\_ansible\_socket’: u’/Users/user/.ansible/pc/ff4b836769’, ‘\_ansible\_diff’: False, ‘\_ansible\_debug’: True, ‘\_ansible\_check\_mode’: False})  
29707 1498596208.35751: handler run complete  
29707 1498596208.35797: attempt loop complete, returning result  
29707 1498596208.35854: \_execute() done  
29707 1498596208.35886: dumping result to json  
29707 1498596208.35932: done dumping result, returning  
29707 1498596208.35981: done running TaskExecutor() for switch/TASK: Pushing config … please wait  
29707 1498596208.36033: sending task result  
29707 1498596208.36108: done sending task result  
29707 1498596208.36175: WORKER PROCESS EXITING  
29528 1498596208.36396: marking switch as failed  
29528 1498596208.36502: marking host switch failed, current state: HOST STATE: block=2, task=1, rescue=0, always=0, run\_state=ITERATING\_TASKS, fail\_state=FAILED\_NONE, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
29528 1498596208.36539: ^ failed state is now: HOST STATE: block=2, task=1, rescue=0, always=0, run\_state=ITERATING\_COMPLETE, fail\_state=FAILED\_TASKS, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
29528 1498596208.36566: getting the next task for host switch  
29528 1498596208.37065: host switch is done iterating, returning  
fatal: [switch]: FAILED! =\> {“changed”: false, “failed”: true, “msg”: “one of candidate or rollback must be specified”}

Thanks!

---

<div class="post-metadata">

**Author:** ![ganeshrn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ganeshrn/32/1021_2.png) [@ganeshrn](https://forum.ansible.com/u/ganeshrn)\
**Post date:** [June 28, 2017, 10:54am UTC](https://forum.ansible.com/t/problems-updating-junos-configuration-with-new-modules-versions/24834/2 "2017-06-28T10:54:02Z")

</div>

As per logs, value of `src` parameter is null

“src”: null

It seems there is an issue in your playbook.

Can you please make below change in the playbook and retry.

junos\_config:

provider: “{{ junos\_creds }}”  
src: “{{ junos\_conf }}”  
update: override  
comment: Test pushed by ansible

Regards,  
Ganesh

---

<div class="post-metadata">

**Author:** ![Siegfried](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@Siegfried](https://forum.ansible.com/u/Siegfried)\
**Post date:** [June 28, 2017, 12:45pm UTC](https://forum.ansible.com/t/problems-updating-junos-configuration-with-new-modules-versions/24834/3 "2017-06-28T12:45:16Z")

</div>

Indeed, thanks a lot. I had tried a few things with the “src”, but never realized at least the mistake of the “\>” after junos\_config. All good now at least with the native modules!

Regards,  
Sieg
