Hi,
I'm trying to run Ansible script to change the domain-name on SRX. basically, I'm testing it so that later can add more configuration but I ran into error.
{"msg": "Error: Module unable to decode valid JSON on stdin. Unable to figure out what parameters were passed", "failed": true}
My set file contains this text, I have tied using .set extension as well and got same error.
yasir@yasir-VM:/etc/ansible/roles/Juniper.junos/tasks$ cat /home/yasir/Ansible_labs/juniper/set-domain.conf
set system domain-name test.com
Host Details
yasir@yasir-VM:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
yasir@yasir-VM:~$ python --version
Python 2.7.6
yasir@yasir-VM:~$ ansible --version
ansible 2.3.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
Here is the error message, I ran ansible in verbose mode to have more details
yasir@yasir-VM:/etc/ansible/roles/Juniper.junos/tasks$ ansible-playbook SET.yml -vvvv
Using /etc/ansible/ansible.cfg as config file
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
Loading callback plugin jsnapy of type aggregate, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
PLAYBOOK: SET.yml *******************************************************************************************
1 plays in SET.yml
PLAY [SET] **************************************************************************************************
META: ran handlers
TASK [CHECK-NETCONF] ****************************************************************************************
task path: /etc/ansible/roles/Juniper.junos/tasks/SET.yml:12
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/utilities/logic/wait_for.py
<192.168.56.103> ESTABLISH LOCAL CONNECTION FOR USER: yasir
<192.168.56.103> EXEC /bin/sh -c 'echo ~ && sleep 0'
<192.168.56.103> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/yasir/.ansible/tmp/ansible-tmp-1492548249.79-279977122145558 `" && echo ansible-tmp-1492548249.79-279977122145558="` echo /home/yasir/.ansible/tmp/ansible-tmp-1492548249.79-279977122145558 `" ) && sleep 0'
<192.168.56.103> PUT /tmp/tmp0NUEpw TO /home/yasir/.ansible/tmp/ansible-tmp-1492548249.79-279977122145558/wait_for.py
<192.168.56.103> EXEC /bin/sh -c 'chmod u+x /home/yasir/.ansible/tmp/ansible-tmp-1492548249.79-279977122145558/ /home/yasir/.ansible/tmp/ansible-tmp-1492548249.79-279977122145558/wait_for.py && sleep 0'
<192.168.56.103> EXEC /bin/sh -c '/usr/bin/python /home/yasir/.ansible/tmp/ansible-tmp-1492548249.79-279977122145558/wait_for.py; rm -rf "/home/yasir/.ansible/tmp/ansible-tmp-1492548249.79-279977122145558/" > /dev/null 2>&1 && sleep 0'
ok: [192.168.56.103] => {
"changed": false,
"elapsed": 0,
"invocation": {
"module_args": {
"active_connection_states": [
"ESTABLISHED",
"SYN_SENT",
"SYN_RECV",
"FIN_WAIT1",
"FIN_WAIT2",
"TIME_WAIT"
],
"connect_timeout": 5,
"delay": 0,
"exclude_hosts": null,
"host": "192.168.56.103",
"path": null,
"port": 22,
"search_regex": null,
"sleep": 1,
"state": "started",
"timeout": 300
}
},
"path": null,
"port": 22,
"search_regex": null,
"state": "started"
}
TASK [SET-DOMAIN] *******************************************************************************************
task path: /etc/ansible/roles/Juniper.junos/tasks/SET.yml:15
{"msg": "Error: Module unable to decode valid JSON on stdin. Unable to figure out what parameters were passed", "failed": true}
Here is my yml file
---
- name: SET
hosts: 192.168.56.103
roles:
- Juniper.junos
connection: local
gather_facts: no
# Execute tasks (plays) this way "ansible-playbook <path>/SET.yml --tags <tag-name>"
tasks:
# Check if a device is NETCONF-aware
- name: CHECK-NETCONF
tags: check-netconf
wait_for: host="{{ inventory_hostname }}" port="{{ juniper_port }}"
- name: SET-DOMAIN
tags: set-domain
junos_install_config: host="{{ inventory_hostname }}" user="{{ juniper_user }}" port="{{ juniper_port }}"
comment="Setup domain-name"
file="/home/yasir/Ansible_labs/juniper/set-domain.conf"
#Ansible