Two issue when configuring ansible

Hi,

I met two issues when I’m trying to configure my system, could you help take a look ?

  1. When I try to get system info by using “-m setup” on some legacy boxes which running RHEL 4 OS on them, the following error occurred.
    I also tried on RHEL 5/6 system are fine by using ansible_python_interpreter variable ( ansible version: 1.1/1.2 )

$ ansible -m setup all -i test.list -u root -c ssh
10.10.10.17 | FAILED => failed to parse: Traceback (most recent call last):
File “/root/.ansible/tmp/ansible-1374817839.87-128978320837516/setup”, line 2419, in
main()
File “/root/.ansible/tmp/ansible-1374817839.87-128978320837516/setup”, line 1581, in main
data = run_setup(module)
File “/root/.ansible/tmp/ansible-1374817839.87-128978320837516/setup”, line 1526, in run_setup
facts = ansible_facts()
File “/root/.ansible/tmp/ansible-1374817839.87-128978320837516/setup”, line 1516, in ansible_facts
facts.update(Hardware().populate())
File “/root/.ansible/tmp/ansible-1374817839.87-128978320837516/setup”, line 421, in populate
self.get_device_facts()
File “/root/.ansible/tmp/ansible-1374817839.87-128978320837516/setup”, line 548, in get_device_facts
m = re.match(“.?([(.)])”, scheduler)
File “/usr/local/lib/python2.7/re.py”, line 137, in match
return _compile(pattern, flags).match(string)
TypeError: expected string or buffer

test.list file like below:
10.10.10.17 ansible_python_interpreter=/usr/local/bin/python (python 2.7)

  1. When I running ansible-playbook check , service restart handler failed to centos 6 boxes.

$ ansible-playbook -i inventory playbooks/groups/debug.yml --check -vvv

failed: [10.10.10.14] => {“failed”: true, “item”: “”, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/root/.ansible/tmp/ansible-1374818751.46-85400547652429/service”, line 1913, in
main()
File “/root/.ansible/tmp/ansible-1374818751.46-85400547652429/service”, line 975, in main
service.get_service_status()
File “/root/.ansible/tmp/ansible-1374818751.46-85400547652429/service”, line 419, in get_service_status
rc, status_stdout, status_stderr = self.service_control()
File “/root/.ansible/tmp/ansible-1374818751.46-85400547652429/service”, line 550, in service_control
rc_state, stdout, stderr = self.execute_command(“%s %s %s” % (svc_cmd, self.action, arguments), daemonize=True)
File “/root/.ansible/tmp/ansible-1374818751.46-85400547652429/service”, line 220, in execute_command
return json.loads(data)
File “/usr/lib64/python2.6/json/init.py”, line 307, in loads
return _default_decoder.decode(s)
File “/usr/lib64/python2.6/json/decoder.py”, line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib64/python2.6/json/decoder.py”, line 338, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded

The handler part getting errors when check step to handler “service someapp restart” ,but RHEL 5 OS system return the normal output.

iptables

  • name: restart iptables
    action: service name=iptables state=restarted

Thanks
Ethan Zhan

(A)

Can you please file a github issue for this? I think it should be easy enough to ignore the error condition and keep generating the rest of the facts.

(B)

Haven’t seen this before, the remote OS is CentOS 6?

Can you run the service module locally on the remote machine with ./hacking/test-module -m -a “arguments” to see what output it is producing?

(A) Github issue #3680 for tracking.

(B) Never mind, the culprit was $LANG, it’s fixed, thanks for you help.

Thanks
Ethan