Ansible fails to pass a simple shell command to an AIX server : error message "SyntaxError: invalid syntax\r\n", "msg": "MODULE FAILURE"

1,123 views
Skip to first unread message

Nicolette Kis

unread,
Feb 3, 2016, 1:10:54 AM2/3/16
to Ansible Project
Hello there,
I have the following error message when I run a simple playbook with ("ls -l" shell a command). Could help me to find out what is wrong here ?
Below is the debug error message :

TASK [setup] *******************************************************************

<192.168.14.224> ESTABLISH SSH CONNECTION FOR USER: cissys

<192.168.14.224> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/vagrant/.ssh/id_rsa.cobolDeploy"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=cissys -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.14.224 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1454436132.22-153236961992754 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1454436132.22-153236961992754 )" )'

<192.168.14.224> PUT /tmp/tmp_FdaTK TO /home/cissys/.ansible/tmp/ansible-tmp-1454436132.22-153236961992754/setup

<192.168.14.224> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/vagrant/.ssh/id_rsa.cobolDeploy"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=cissys -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.14.224]'

<192.168.14.224> ESTABLISH SSH CONNECTION FOR USER: cissys

<192.168.14.224> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/vagrant/.ssh/id_rsa.cobolDeploy"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=cissys -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.14.224 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 PATH=/usr/bin/python:$PATH python /home/cissys/.ansible/tmp/ansible-tmp-1454436132.22-153236961992754/setup; rm -rf "/home/cissys/.ansible/tmp/ansible-tmp-1454436132.22-153236961992754/" > /dev/null 2>&1'

fatal: [192.168.14.224]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "setup"}, "module_stderr": "OpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2455\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.14.224 closed.\r\n", "module_stdout": "  File \"/home/cissys/.ansible/tmp/ansible-tmp-1454436132.22-153236961992754/setup\", line 3160\r\n    except OSError, e:\r\n                  ^\r\nSyntaxError: invalid syntax\r\n", "msg": "MODULE FAILURE", "parsed": false} 

Matt Martz

unread,
Feb 3, 2016, 7:28:54 AM2/3/16
to ansible...@googlegroups.com
That error is due to the playbook running the setup module during the gather facts step and not having python2 available at /use/bin/Python but instead having python3.

If you are just trying to run script without running setup, add `gather_facts: false` to your play definition.

Otherwise you will need to ensure python2 is installed and that you provide its path via ansible_python_interpreter.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2d0f43f6-2c87-43ac-9354-7fdffea01c48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Reply all
Reply to author
Forward
0 new messages