# optional template?

**URL:** <https://forum.ansible.com/t/optional-template/29713>\
**Category:** Ansible Project\
**Created:** [February 19, 2019, 8:11pm UTC](https://forum.ansible.com/t/optional-template/29713 "2019-02-19T20:11:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Matz1](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@Guy\_Matz1](https://forum.ansible.com/u/Guy_Matz1)\
**Post date:** [February 19, 2019, 8:11pm UTC](https://forum.ansible.com/t/optional-template/29713/1 "2019-02-19T20:11:26Z")

</div>

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!!
