# set object property using set\_fact

**URL:** <https://forum.ansible.com/t/set-object-property-using-set-fact/32340>\
**Category:** Ansible Project\
**Created:** [February 27, 2020, 8:57am UTC](https://forum.ansible.com/t/set-object-property-using-set-fact/32340 "2020-02-27T08:57:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shyam\_Sunder1](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@Shyam\_Sunder1](https://forum.ansible.com/u/Shyam_Sunder1)\
**Post date:** [February 27, 2020, 8:57am UTC](https://forum.ansible.com/t/set-object-property-using-set-fact/32340/1 "2020-02-27T08:57:18Z")

</div>

Hi,

I am new to Ansible an trying to achieve this below. Is this possible to set a dictionary property using key in Ansible.

`vars: mydict: keyA: path: ‘path of device A’ error_files: [] keyB: path: ‘path of device B’ error_files: []`

`

- name: collect errors of device A  
set\_fact:  
mydict[‘keyA’].error\_files: “mydict[‘keyA’].error\_files + item ”  
loop: “{{error\_files\_ofdeviceA }}”  
`

Thanks

---

<div class="post-metadata">

**Author:** ![Shyam\_Sunder1](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@Shyam\_Sunder1](https://forum.ansible.com/u/Shyam_Sunder1)\
**Post date:** [February 27, 2020, 9:00am UTC](https://forum.ansible.com/t/set-object-property-using-set-fact/32340/2 "2020-02-27T09:00:25Z")

</div>

On the same not, can I use something like below -

`

- name: setting up item property  
set\_fact:  
item.founderror: true  
loop: “{{ device\_list }}”  
`

here device\_list is a list of object where I would like to add/update a property founderror.

Thanks
