Playbook fails on one remote server (running Gentoo), but succeedes on the rest 5 remote servers (running different version of CentOS)

Hi Guys,

I’ve set up a Playbook to update ACLs on few servers (one running Gentoo, the others are CentOS). The Playbook works fine for the CentOS machines, but fails for the Gentoo one, here’s the error:

failed: [gsqtest] => {“failed”: true, “parsed”: false}

BECOME-SUCCESS-zizdmceeozmgzqpqixbpxrpnjjkfzghn
File “/home/testuser/.ansible/tmp/ansible-tmp-1435069044.18-160883359153300/service”, line 417
except IOError, err:
^
SyntaxError: invalid syntax
debug1: mux_client_request_session: master session id: 2
Shared connection to gsqtest closed.

FATAL: all hosts have already failed – aborting

The Playbook has 2 tasks, the first finishes ok, the second one, which is to restart a service, fails.

Any idea what might be the issue?

Regards,
Dimitar

on the gentoo machine you are hitting python v3, ansible needs v2 for it’s modules, you should either set ansible_python_interpreter for that host to point to the v2 python or change the default python to the v2 version.

Hi Brian,

that’s absolutely right. I changed the default python and the playbook passed successfully.
test tmp # eselect python list
Available Python interpreters:
[1] python2.7
[2] python3.2 *
[3] python3.3
test tmp # eselect python set python2.7
test tmp # eselect python list
Available Python interpreters:
[1] python2.7 *
[2] python3.2
[3] python3.3

Thanks,
Dimitar