0

Had any tried to use Ansible (ansible 1.9.4) Netscaler module ? I tried to use it but failed with error:

ansible localhost  -m netscaler -a  "nsc_host=nsc.example.com  user=nscuser password=nscpassword  name=node1.example.com type=service action=disable validate_certs=False"


localhost | FAILED >> {
    "failed": true,
    "msg": "'NoneType' object has no attribute 'read'"
}

with -vvvv output:

<localhost> REMOTE_MODULE netscaler nsc_host=nsc.example.com    user= nscuser     password=VALUE_HIDDEN name=node1.example.com type=service action=disable validate_certs=False
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1460868653.22-66856743808206 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1460868653.22-66856743808206 && echo $HOME/.ansible/tmp/ansible-tmp-1460868653.22-66856743808206']
<localhost> PUT /tmp/tmpAfQPY2 TO /home/supp/.ansible/tmp/ansible-tmp-1460868653.22-66856743808206/netscaler
<localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8    /usr/local/bin/python2.7 /home/supp/.ansible/tmp/ansible-tmp-1460868653.22- 66856743808206/netscaler; rm -rf /home/supp/.ansible/tmp/ansible-tmp- 1460868653.22-66856743808206/ >/dev/null 2>&1']
localhost | FAILED >> {
    "failed": true,
    "msg": "'NoneType' object has no attribute 'read'"
}

with unusable 1.9.5:

/usr/bin/ansible --version
ansible 1.9.5
  configured module search path = None


/usr/bin/ansible localhost -m netscaler -a  "nsc_host=nsc.example.com    user= nscuser     password=VALUE_HIDDEN name=node1.example.com type=service action=disable  validate_certs=False" -vvvv

<localhost> REMOTE_MODULE netscaler nsc_host=nsc.example.com    user= nscuser     password=VALUE_HIDDEN name=node1.example.com type=service action=disable validate_certs=False
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1460873442.75-215681661318620 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1460873442.75-215681661318620 && echo $HOME/.ansible/tmp/ansible-tmp-1460873442.75-215681661318620']
<localhost> PUT /tmp/tmpiN_wRf TO /home/supp/.ansible/tmp/ansible-tmp-1460873442.75-215681661318620/netscaler
<localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8    /usr/bin/python26 /home/supp/.ansible/tmp/ansible-tmp-1460873442.75-215681661318620/netscaler; rm -rf /home/supp/.ansible/tmp/ansible-tmp-1460873442.75-215681661318620/ >/dev/null 2>&1']
localhost | FAILED >> {
    "failed": true,
    "msg": "'NoneType' object has no attribute 'read'"
}

note: localhost is not NETSCALER, it is a manage host.

I also tried to use the module in playbook but still failed.

Hope to hear suggestion from you .

Thanks.

SGM
  • 1
  • 2
  • What's the output when you add `-vvvv`? (Edit the question to include the output). – tedder42 Apr 16 '16 at 20:06
  • @tedder42, output with -vvvv had been added to the question, but I don't think it is helpful. The "localhost" is not NETSCALER, just a manage host. Thanks. – SGM Apr 17 '16 at 04:58
  • Can you update to 1.9.5 or 1.9.6? I have a hunch on a bugfix. – tedder42 Apr 17 '16 at 05:02
  • Thank you @tedder42, upgrading ANSIBLE to 2.0.1.0 with "sudo pip install ansible --upgrade" but still got the same error, so I have to use 1.9.5 or 1.9.6 ? – SGM Apr 17 '16 at 05:48
  • Yeah, use 1.9.5 or 1.9.6. The fix was in (I think) 95. If that fails we can continue digging. – tedder42 Apr 17 '16 at 05:49
  • @tedder42 same error when using ANSIBLE 1.9.5 and 1.9.6, question updated with details. – SGM Apr 17 '16 at 06:17

1 Answers1

0

While the error isn't very informative, the problem is a connectivity one. The module has not been able to connect to the netscaler. Check your network connection & ensure there are no firewalls in the way.

The root cause is from

response, info = fetch_url(self.module, request_url, data=data_json, headers=headers)
return json.load(response)

"response" got nothing back so is if "None" type and so json.load cannot read None.

A pull request with slightly more helpful error handling is at https://github.com/ansible/ansible-modules-extras/pull/2327

Timothy c
  • 751
  • 7
  • 8