How would you do that in playbook... My playbook has only a few lines, all logic is done in templates. I have maybe 300 variables per environment, if I all that do in playbook, then playbook would be pretty unreadable.
This is done in the template, I check is var in some list (list contain possible values). But, how to raise an exception if the variable is not in the list of possible (acceptable) values. Dana utorak, 21. veljače 2017. u 14:29:01 UTC+1, korisnik Adam Hamsik napisao je: > > Hi, > > There is no such filter for that but you can do that with if. IMHO jinja > template is not right place for validating variable values. Much better > place would be playbook. > > On Tue, Feb 21, 2017 at 12:26 PM, vu001 <bruno.k...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> is it possible in Jinja2 template to define possible values for some >> variable. >> >> Let say I have template config1.j2: >> >> parameter1={{var1 | default(1) }} >> parameter2={{var2 | default(2) }} >> parameter3={{var3 | default(3) }} >> >> So, I would like that to parameter1..3 must be assigned only values 1 or >> 2 or 3. >> How to achieve that without using "if" statement. >> >> Is it possible somehow to define possible values like is "default" value >> is defined? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to ansible-deve...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > > Regards. > > Adam > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.