# Can you do something similar with\_items on a role?

**URL:** <https://forum.ansible.com/t/can-you-do-something-similar-with-items-on-a-role/17779>\
**Category:** Ansible Project\
**Created:** [March 18, 2015, 10:44pm UTC](https://forum.ansible.com/t/can-you-do-something-similar-with-items-on-a-role/17779 "2015-03-18T22:44:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Hardwick](https://avatars.discourse-cdn.com/v4/letter/p/71e660/32.png) [@Paul\_Hardwick](https://forum.ansible.com/u/Paul_Hardwick)\
**Post date:** [March 18, 2015, 10:44pm UTC](https://forum.ansible.com/t/can-you-do-something-similar-with-items-on-a-role/17779/1 "2015-03-18T22:44:15Z")

</div>

I am looking to update multiple similar config files and am looking for the best path.

Updating individual files I have down pat with lineinfile and with\_items. The trick this time is that I have a directory that contains multiple files in which I want to make the same update. My original idea was to make a role that made the multiple updates to an individual file using with\_items. I was then thinking of trying to use with\_items on the role. Unfortunately it looks like I can’t use with\_items on a call to a role.

If I have to I can just call the role multiple times with a variable name with the file name as a parameter. Is that my best bet or did I miss something ?

`

# update config file

- { role: update-config-file  
with\_items:
- { tool-file-name: ‘file1’ }
- { tool-file-name: ‘file2’ }
- { tool-file-name: ‘file3’ }  
}
