Consider the following scenario:
1) I have a number of config files to deploy. They all are named similarly, allowing for me to use templating to cut down on the amount of file states I have to type out.
2) Several of these config files also have a shell script that accompany them, with the same naming convention. But not every config file has a shell script, so I can't just put both file states within the same for loop.
I can just break it up into two separate for loops, with one loop having states for both config file and shell script, and another with the ones that just have shell scripts. However, this means that the code that sets up the file state for the config file is duplicated, which is something I would like to avoid. What I would really like is something like the following pseudo-code:
for type in 'a','b','c','d','e','f'
config file state goes here
if type not in 'd','f'
shell script state goes here
endif
endfor
This link (
http://jinja.pocoo.org/docs/templates/#builtin-tests) would suggest there is no built-in test to see if a value is a member of a given iterable, but I was wondering if there was perhaps another way to tackle this.