Issue 1:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible-playbook 2.2.0 (devel 329c62e914) last updated 2016/05/26 15:44:10 (GMT +200)
lib/ansible/modules/core: (detached HEAD fb77ab49ab) last updated 2016/05/26 15:44:35 (GMT +200)
lib/ansible/modules/extras: (detached HEAD 0e4a023a7e) last updated 2016/05/26 15:45:04 (GMT +200)
config file = /home/daniel/Documents/openstack/ansible.cfg
configured module search path = Default w/o overrides

CONFIGURATION

[defaults]
inventory = testing
action_plugins = plugins/actions

OS / ENVIRONMENT

Source:

Arch Linux with virtualenv for python2

Linux Mint 17.3

Destination:

Ubuntu Xenial

SUMMARY

Configuring Rabbitmq users was working with Ansible version 2.0.2.0 but not with 2.1.0.0 or later.

I am reporting this issue in this repository since my investigation and the error message should be linked with the module_utils library rather then the extra module rabbitmq_user itself.

STEPS TO REPRODUCE

---
- hosts: controller
tasks:
- name: add rabbitmq user and set privileges
rabbitmq_user:
user={{ item.user }}
password={{ item.password }}
vhost={{ item.vhost | default('/', false) }}
node={{ item.node | default('rabbit') }}
tags={{ (item.tags | default('')) | join(',') }}
configure_priv={{ item.configure_priv | default('.*') }}
read_priv={{ item.read_priv | default('.*') }}
write_priv={{ item.write_priv | default('.*') }}
state=present
force={{ item.force|default('yes') }}
with_items:
- vhost : /
user : openstack-glance
password: password
- vhost : /
user : openstack-nova
password: password

EXPECTED RESULTS

The configuration should be carried out without errors.

ACTUAL RESULTS

TASK [add rabbitmq user and set privileges] ************************************
task path: /home/daniel/Documents/openstack/playbook.yml:4
Using module file /home/daniel/Downloads/ansible/lib/ansible/modules/extras/messaging/rabbitmq_user.py
<192.168.33.11> ESTABLISH SSH CONNECTION FOR USER: openstackadmin
<192.168.33.11> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.33.11 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464271664.69-10598674319575 `" && echo ansible-tmp-1464271664.69-10598674319575="` echo $HOME/.ansible/tmp/ansible-tmp-1464271664.69-10598674319575 `" ) && sleep 0'"'"''
<192.168.33.11> PUT /tmp/tmpDCHXsj TO /home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.69-10598674319575/rabbitmq_user.py
<192.168.33.11> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.33.11]'
<192.168.33.11> ESTABLISH SSH CONNECTION FOR USER: openstackadmin
<192.168.33.11> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.33.11 '/bin/sh -c '"'"'chmod -R u+x /home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.69-10598674319575/ && sleep 0'"'"''
<192.168.33.11> ESTABLISH SSH CONNECTION FOR USER: openstackadmin
<192.168.33.11> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.33.11 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-lcmcxuyhulniwzrxxspkbqiswrciptnq; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.69-10598674319575/rabbitmq_user.py; rm -rf "/home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.69-10598674319575/" > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"''
failed: [control01t] (item={u'vhost': u'/', u'password': u'password', u'user': u'openstack-glance'}) => {"failed": true, "invocation": {"module_name": "rabbitmq_user"}, "item": {"password": "password", "user": "openstack-glance", "vhost": "/"}, "module_stderr": "OpenSSH_7.2p2, OpenSSL 1.0.2h 3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\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 = 13588\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.33.11 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py\", line 302, in <module>\r\n main()\r\n File \"/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py\", line 274, in main\r\n if rabbitmq_user.get():\r\n File \"/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py\", line 155, in get\r\n users = self._exec(['list_users'], True)\r\n File \"/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py\", line 150, in _exec\r\n rc, out, err = self.module.run_command(cmd + args, check_rc=True)\r\n File \"/tmp/ansible_YLKqns/ansible_modlib.zip/ansible/module_utils/basic.py\", line 1987, in run_command\r\n File \"/usr/lib/python2.7/posixpath.py\", line 254, in expanduser\r\n if not path.startswith('~'):\r\nAttributeError: 'list' object has no attribute 'startswith'\r\n", "msg": "MODULE FAILURE", "parsed": false}
Using module file /home/daniel/Downloads/ansible/lib/ansible/modules/extras/messaging/rabbitmq_user.py
<192.168.33.11> ESTABLISH SSH CONNECTION FOR USER: openstackadmin
<192.168.33.11> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.33.11 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464271664.97-84308363939202 `" && echo ansible-tmp-1464271664.97-84308363939202="` echo $HOME/.ansible/tmp/ansible-tmp-1464271664.97-84308363939202 `" ) && sleep 0'"'"''
<192.168.33.11> PUT /tmp/tmpnLcQFI TO /home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.97-84308363939202/rabbitmq_user.py
<192.168.33.11> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.33.11]'
<192.168.33.11> ESTABLISH SSH CONNECTION FOR USER: openstackadmin
<192.168.33.11> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.33.11 '/bin/sh -c '"'"'chmod -R u+x /home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.97-84308363939202/ && sleep 0'"'"''
<192.168.33.11> ESTABLISH SSH CONNECTION FOR USER: openstackadmin
<192.168.33.11> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=openstackadmin -o ConnectTimeout=10 -o ControlPath=/home/daniel/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.33.11 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-qeweypikyceddwcyzvrgqhhikuzjzorn; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.97-84308363939202/rabbitmq_user.py; rm -rf "/home/openstackadmin/.ansible/tmp/ansible-tmp-1464271664.97-84308363939202/" > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"''
failed: [control01t] (item={u'vhost': u'/', u'password': u'password', u'user': u'openstack-nova'}) => {"failed": true, "invocation": {"module_name": "rabbitmq_user"}, "item": {"password": "password", "user": "openstack-nova", "vhost": "/"}, "module_stderr": "OpenSSH_7.2p2, OpenSSL 1.0.2h 3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\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 = 13588\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.33.11 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_oJbdN0/ansible_module_rabbitmq_user.py\", line 302, in <module>\r\n main()\r\n File \"/tmp/ansible_oJbdN0/ansible_module_rabbitmq_user.py\", line 274, in main\r\n if rabbitmq_user.get():\r\n File \"/tmp/ansible_oJbdN0/ansible_module_rabbitmq_user.py\", line 155, in get\r\n users = self._exec(['list_users'], True)\r\n File \"/tmp/ansible_oJbdN0/ansible_module_rabbitmq_user.py\", line 150, in _exec\r\n rc, out, err = self.module.run_command(cmd + args, check_rc=True)\r\n File \"/tmp/ansible_oJbdN0/ansible_modlib.zip/ansible/module_utils/basic.py\", line 1987, in run_command\r\n File \"/usr/lib/python2.7/posixpath.py\", line 254, in expanduser\r\n if not path.startswith('~'):\r\nAttributeError: 'list' object has no attribute 'startswith'\r\n", "msg": "MODULE FAILURE", "parsed": false}

Pretty print of the python error:

Traceback (most recent call last):
File "/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py", line 302, in <module>
main()
File "/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py", line 274, in main
if rabbitmq_user.get():
File "/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py", line 155, in get
users = self._exec(['list_users'], True)
File "/tmp/ansible_YLKqns/ansible_module_rabbitmq_user.py", line 150, in _exec
rc, out, err = self.module.run_command(cmd + args, check_rc=True)
File "/tmp/ansible_YLKqns/ansible_modlib.zip/ansible/module_utils/basic.py", line 1987, in run_command
File "/usr/lib/python2.7/posixpath.py", line 254, in expanduser
if not path.startswith('~'):
AttributeError: 'list' object has no attribute 'startswith'

Issue 2:
Version:

ansible-playbook 2.0.0 (devel 8f77dd1) last updated 2015/10/26 11:46:26 (GMT -400)

lib/ansible/modules/core: (detached HEAD 06f301b) last updated 2015/10/26 11:46:28 (GMT -400)

lib/ansible/modules/extras: (detached HEAD 405c3cb) last updated 2015/10/26 11:46:30 (GMT -400)

Issue:

When the server is not online, the error message is confusing.

What happens now:

Get the error message:

fatal: [10.10.67.157]: FAILED! => {"failed": true, "msg": "ERROR! Timeout (10s) waiting for privilege escalation prompt: "}

What should happen:

fatal: [10.10.67.157]: FAILED! => {"failed": true, "msg": "ERROR! Unable to connect to server "}