Can you do something similar with_items on a role?

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’ }
    }