ec2_vol create dynamic number

Hi,

How can I extend the following code to allow me to specify a number of additional volumes to add?

  • name: create ec2 vols for raid
    local_action: ec2_vol
    instance=“{{ item[0].id }}”
    volume_size=“{{ md_vol_size }}”
    device_name=“{{ item[1] }}”
    region=“{{ item[0].region }}”
    with_nested:
  • ec2_info.instances
  • [‘xvdg’, ‘xvdh’, ‘xvdi’, ‘xvdj’]

I.e sometimes i might want just one additional volume but others i might want to attach 10 xvdg-p ideally based of a variable called ec2_vol_count=X

Thanks

Mark

Although not the nicest way to do it, I recon the with_sequence could come in handy: http://docs.ansible.com/playbooks_loops.html#looping-over-integer-sequences