# Need help with ansible error using register and when condition

**URL:** <https://forum.ansible.com/t/need-help-with-ansible-error-using-register-and-when-condition/32745>\
**Category:** AWX Project\
**Created:** [April 21, 2020, 8:25am UTC](https://forum.ansible.com/t/need-help-with-ansible-error-using-register-and-when-condition/32745 "2020-04-21T08:25:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladimir\_Chavkovski](https://avatars.discourse-cdn.com/v4/letter/v/e36b37/32.png) [@Vladimir\_Chavkovski](https://forum.ansible.com/u/Vladimir_Chavkovski)\
**Post date:** [April 21, 2020, 8:25am UTC](https://forum.ansible.com/t/need-help-with-ansible-error-using-register-and-when-condition/32745/1 "2020-04-21T08:25:31Z")

</div>

|
| |
| 

Ansible playbook with register and when condition getting error

 |
| | |

---

<div class="post-metadata">

**Author:** ![john.westcott.iv](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/john.westcott.iv/32/95_2.png) [@john.westcott.iv](https://forum.ansible.com/u/john.westcott.iv)\
**Post date:** [April 21, 2020, 12:09pm UTC](https://forum.ansible.com/t/need-help-with-ansible-error-using-register-and-when-condition/32745/2 "2020-04-21T12:09:07Z")

</div>

This list is for awx questions; this is really more of an Ansible question and is probably better suited for another list, see: [https://www.ansible.com/community](https://www.ansible.com/community).

However, to answer your question, the field sysinfo.stdout\_lines is an array of arrays of text, not an object.  
You could print out the specific line contains the model number with sysinfo.stdout\_lines[0][2] but you can’t print just the model number without some more work.  
If you specifically want the model you will need to do something to parse that text to get the data.  
There are some parsers for Ansible for Networking but they depend on the being properly coupled with the model of the router, I personally have not used routeros modules so you’d have to do some research there.

On a side note, if you are just after the model number you may be overcomplicating your playbook.  
You might be better suited to just run the routeros\_facts module: [https://docs.ansible.com/ansible/latest/modules/routeros\_facts\_module.html](https://docs.ansible.com/ansible/latest/modules/routeros_facts_module.html) and let it collect the device information.  
After running that module the variable ansible\_net\_model should contain the model number of the device.

-John

---

<div class="post-metadata">

**Author:** ![Vladimir\_Chavkovski](https://avatars.discourse-cdn.com/v4/letter/v/e36b37/32.png) [@Vladimir\_Chavkovski](https://forum.ansible.com/u/Vladimir_Chavkovski)\
**Post date:** [April 21, 2020, 12:58pm UTC](https://forum.ansible.com/t/need-help-with-ansible-error-using-register-and-when-condition/32745/3 "2020-04-21T12:58:03Z")

</div>

Unfortunately this module getting error as well:

---

<div class="post-metadata">

**Author:** ![David\_Maple](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@David\_Maple](https://forum.ansible.com/u/David_Maple)\
**Post date:** [April 21, 2020, 3:15pm UTC](https://forum.ansible.com/t/need-help-with-ansible-error-using-register-and-when-condition/32745/4 "2020-04-21T15:15:04Z")

</div>

This list is not for Ansible support. It is only for the AWX project.

You need to review the documentation for Ansible and the modules you are trying to use, and then, try reaching out to the Ansible community for help.
