Try {{ item|int +1 }} K On 04/02/2014 5:58 AM, <edrozenb...@gmail.com> wrote:
> Hello, > > In certain cases it's useful to be able to add a number to the value of an > {{ item }} variable > > For example when creating md (raid) devices, md0 for example is made up of > partitions sda1 and sdb1. > > with_items: > [ 0, 1, 2, 3, 4 etc ] > > It would be nice to be able to reference {{ item }} for the md device > names as well > as {{ item + 1 }} for the partition names. > > {{ item + 1 }} didn't seem to work for me and I haven't been able to find > anything online or > in the documentation as to whether something like this is possible. > > I wound up using with_together with two sequences for ex. [0, 1, 2 ] and > [1, 2, 3] but it's > not completely elegant and can lead to typing errors. > > Any hints? > > Thanks in advance, > --Ed > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-project+unsubscr...@googlegroups.com. > To post to this group, send email to ansible-project@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.