Ansible ssh error

Hi Everyone,

I trying to run this from Ansible on Ubuntu server and client is Redhat 7 but giving me attached error, please help.

root@kotireddy4781c:/etc/ansible# ansible --version

ansible 2.5.1

config file = /etc/ansible/ansible.cfg

configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]

ansible python module location = /usr/lib/python2.7/dist-packages/ansible

executable location = /usr/bin/ansible

python version = 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0]

Debugging Error Messages,

<172.31.122.1> ESTABLISH SSH CONNECTION FOR USER: root

<172.31.122.1> SSH: ansible.cfg set ssh_args: (-C)(-o)(ControlMaster=auto)(-o)(ControlPersist=60s)

<172.31.122.1> SSH: ansible_password/ansible_ssh_pass not set: (-o)(KbdInteractiveAuthentication=no)(-o)(PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey)(-o)(PasswordAuthentication=no)

<172.31.122.1> SSH: ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set: (-o)(User=root)

<172.31.122.1> SSH: ANSIBLE_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)

<172.31.122.1> SSH: found only ControlPersist; added ControlPath: (-o)(ControlPath=/root/.ansible/cp/7474ddd012)

<172.31.122.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/7474ddd012 172.31.122.1 ‘/bin/sh -c ‘"’“‘rm -f -r /root/.ansible/tmp/ansible-tmp-1585563249.11-149834904099980/ > /dev/null 2>&1 && sleep 0’”’"‘’

<172.31.122.1> (0, ‘’, ‘OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\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 = 7447\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\n’)

fatal: [172.31.122.1]: FAILED! => {

“changed”: false,

“module_stderr”: “OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\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 = 7447\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 1\r\nShared connection to 172.31.122.1 closed.\r\n”,

“module_stdout”: “Traceback (most recent call last):\r\n File "/tmp/ansible_xPOAZ0/ansible_module_firewalld.py", line 1017, in \r\n main()\r\n File "/tmp/ansible_xPOAZ0/ansible_module_firewalld.py", line 856, in main\r\n port, protocol = module.params[‘port’].strip().split(‘/’)\r\nValueError: need more than 1 value to unpack\r\n”,

“msg”: “MODULE FAILURE”,

“rc”: 1

}

  • name: Open NCPA Port (RedHat 7)

firewalld:

immediate: yes

permanent: yes

port: 5693

state: enabled

when: ansible_distribution == “RedHat” and ansible_distribution_major_version|int == 7

From https://docs.ansible.com/ansible/latest/modules/firewalld_module.html#parameter-port

it appears you need to add the protocol as well.
Try:

port: 5693/tcp

Thanks, It’s working now.