# Sentinel - Redis :  fatal: \[pyxrrsap02.pyx.erp\]: FAILED! =\> {"failed": true, "msg": "ERROR! 'list object' has no attribute 'cmd'"}

**URL:** <https://forum.ansible.com/t/sentinel-redis-fatal-pyxrrsap02-pyx-erp-failed-failed-true-msg-error-list-object-has-no-attribute-cmd/19734>\
**Category:** Ansible Project\
**Created:** [November 11, 2015, 10:30am UTC](https://forum.ansible.com/t/sentinel-redis-fatal-pyxrrsap02-pyx-erp-failed-failed-true-msg-error-list-object-has-no-attribute-cmd/19734 "2015-11-11T10:30:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Franckx](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@Eric\_Franckx](https://forum.ansible.com/u/Eric_Franckx)\
**Post date:** [November 11, 2015, 10:30am UTC](https://forum.ansible.com/t/sentinel-redis-fatal-pyxrrsap02-pyx-erp-failed-failed-true-msg-error-list-object-has-no-attribute-cmd/19734/1 "2015-11-11T10:30:54Z")

</div>

Hi,  
I try to connect to a list of Sentinel host to get the master redis host and port.

- name: “CONNECT SENTINEL” command: “redis-cli -h {{ item.allowed\_host }} -p {{ item.port }} SENTINEL get-master-addr-by-name redis-pex-01” with\_items: “{{ production.redis\_params.sentinels }}” register: status\_sentinel ignore\_errors: yes

TASK [CONNECT SENTINEL] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [pyxrrsap02.pyx.erp] =\> (item={u’allowed\_host’: u’pyxrrsap01’, u’port’: 17700}) =\> {“changed”: true, “cmd”: [“redis-cli”, “-h”, “pyxrrsap01”, “-p”, “17700”, “SENTINEL”, “get-master-addr-by-name”, “redis-pex-01”], “delta”: “0:00:00.016587”, “end”: “2015-11-11 00:49:19.387801”, “item”: {“allowed\_host”: “pyxrrsap01”, “port”: 17700}, “rc”: 0, “start”: “2015-11-11 00:49:19.371214”, “stderr”: “”, “stdout”: “10.50.133.20\n6379”, “stdout\_lines”: [“10.50.133.20”, “6379”], “warnings”: }  
changed: [pyxrrsap02.pyx.erp] =\> (item={u’allowed\_host’: u’pyxrrsap01’, u’port’: 27700}) =\> {“changed”: true, “cmd”: [“redis-cli”, “-h”, “pyxrrsap01”, “-p”, “27700”, “SENTINEL”, “get-master-addr-by-name”, “redis-pex-01”], “delta”: “0:00:00.017153”, “end”: “2015-11-11 00:49:19.998121”, “item”: {“allowed\_host”: “pyxrrsap01”, “port”: 27700}, “rc”: 0, “start”: “2015-11-11 00:49:19.980968”, “stderr”: “”, “stdout”: “10.50.133.20\n6379”, “stdout\_lines”: [“10.50.133.20”, “6379”], “warnings”: }

I try to display result f register value:

- name: “DISPLAY SENTINEL VAR 1”  
debug: msg={{ status\_sentinel }}  
ignore\_errors: yes

TASK [DISPLAY SENTINEL VAR 1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [pyxrrsap02.pyx.erp] =\> {  
“changed”: false,  
“msg”: {  
“changed”: true,  
“msg”: “All items completed”,  
“results”: [  
{  
“\_ansible\_no\_log”: false,  
“changed”: true,  
“cmd”: [  
“redis-cli”,  
“-h”,  
“pyxrrsap01”,  
“-p”,  
“17700”,  
“SENTINEL”,  
“get-master-addr-by-name”,  
“redis-pex-01”  
],  
“delta”: “0:00:00.016587”,  
“end”: “2015-11-11 00:49:19.387801”,  
“invocation”: {  
“module\_args”: {  
“\_raw\_params”: “redis-cli -h pyxrrsap01 -p 17700 SENTINEL get-master-addr-by-name redis-pex-01”  
},  
“module\_name”: “command”  
},  
“item”: {  
“allowed\_host”: “pyxrrsap01”,  
“port”: 17700  
},  
“rc”: 0,  
“start”: “2015-11-11 00:49:19.371214”,  
“stderr”: “”,  
“stdout”: “10.50.133.20\n6379”,  
“stdout\_lines”: [  
“10.50.133.20”,  
“6379”  
],  
“warnings”:   
},  
{  
“\_ansible\_no\_log”: false,  
“changed”: true,  
“cmd”: [  
“redis-cli”,  
“-h”,  
“pyxrrsap01”,  
“-p”,  
“27700”,  
“SENTINEL”,  
“get-master-addr-by-name”,  
“redis-pex-01”  
],  
“delta”: “0:00:00.017153”,  
“end”: “2015-11-11 00:49:19.998121”,  
“invocation”: {  
“module\_args”: {  
“\_raw\_params”: “redis-cli -h pyxrrsap01 -p 27700 SENTINEL get-master-addr-by-name redis-pex-01”  
},  
“module\_name”: “command”  
},  
“item”: {  
“allowed\_host”: “pyxrrsap01”,  
“port”: 27700  
},  
“rc”: 0,  
“start”: “2015-11-11 00:49:19.980968”,  
“stderr”: “”,  
“stdout”: “10.50.133.20\n6379”,  
“stdout\_lines”: [  
“10.50.133.20”,  
“6379”  
],  
“warnings”:   
}  
]  
}  
}

But when it tries to parse to have detail it doesn’t work:

- name: “DISPLAY SENTINEL VAR 1 1”  
debug: msg={{ status\_sentinel.results.cmd }}  
ignore\_errors: yes

```auto
- name: "DISPLAY SENTINEL VAR 1 2"
  debug: msg={{ item.cmd }}
  with_items: ${status_sentinel.results}
  ignore_errors: yes

```

TASK [DISPLAY SENTINEL VAR 1 1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [pyxrrsap02.pyx.erp]: FAILED! =\> {“failed”: true, “msg”: “ERROR! ‘list object’ has no attribute ‘cmd’”}  
…ignoring

TASK [DISPLAY SENTINEL VAR 1 2] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [pyxrrsap02.pyx.erp]: FAILED! =\> {“failed”: true, “msg”: “ERROR! ‘unicode object’ has no attribute ‘cmd’”}  
…ignoring

or like this :

- name: “DISPLAY SENTINEL VAR 2 1”  
debug: var={{ item }}  
with\_items: ${status\_sentinel.results}  
ignore\_errors: yes

doesn’t work:  
TASK [DISPLAY SENTINEL VAR 2 1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [pyxrrsap02.pyx.erp] =\> (item=${status\_sentinel.results}) =\> {  
“${status\_sentinel.results}”: “VARIABLE IS NOT DEFINED!”,  
“item”: “${status\_sentinel.results}”

Any idea ?

Regards,

---

<div class="post-metadata">

**Author:** ![Eric\_Franckx](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@Eric\_Franckx](https://forum.ansible.com/u/Eric_Franckx)\
**Post date:** [November 12, 2015, 1:20pm UTC](https://forum.ansible.com/t/sentinel-redis-fatal-pyxrrsap02-pyx-erp-failed-failed-true-msg-error-list-object-has-no-attribute-cmd/19734/2 "2015-11-12T13:20:03Z")

</div>

SOLVED:

Simple by using : [0][0] and [0][1] to get the correct value/parameters.
