optional template?

Hi! I am installing some packages based on a list, and I would like to put a config file in place for each package, however I would like the config file to be optional. For example, if I have this list of packages to install:
pkgs:

  • a
  • b
  • c

I have code that install the pkgs, and I would like to put a template in place for any packages that require it, which means that I would like to loop through the pkgs var and render the templates a.conf.j2, b.conf.j2 and c.conf.j2. But if I add a package d, that does not require a template, I don’t want to have to put an empty template in place . . . I could use ‘failed_when: false’ but that will not complain if the jinja in the template is bad or a var is missing . . . so is there a way to specify the errors that are acceptable, e.g. missing template? or a way to specify which errors can be ignored with ‘ignore_errors’?

Thanks!!