# set default when using an undefined variable in "with\_sequence"

**URL:** <https://forum.ansible.com/t/set-default-when-using-an-undefined-variable-in-with-sequence/19020>\
**Category:** Ansible Project\
**Created:** [August 14, 2015, 2:51pm UTC](https://forum.ansible.com/t/set-default-when-using-an-undefined-variable-in-with-sequence/19020 "2015-08-14T14:51:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [August 14, 2015, 2:51pm UTC](https://forum.ansible.com/t/set-default-when-using-an-undefined-variable-in-with-sequence/19020/1 "2015-08-14T14:51:28Z")

</div>

What is the proper way to set a default for helios\_web1b.count?

Currently this task:

`

- name: create identifier sequence for tagging web1b  
no\_log: true  
debug: msg=“{{ item }}”  
with\_sequence:  
start=0  
count=“{{ helios\_web1b.count }}”  
format=%02d  
register: sequence  
`

results in:

`  
TASK: [helios\_aws\_multi | create identifier sequence for tagging web1b] \*\*\*\*\*\*\*  
fatal: [localhost] =\> unknown error parsing with\_sequence arguments: u’start=0 count=“{{ helios\_web1b.count }}” format=%02d’

FATAL: all hosts have already failed – aborting  
`

I tried:

`

- name: create identifier sequence for tagging web1b  
no\_log: true  
debug: msg=“{{ item }}”  
with\_sequence:  
start=0  
count=“{{ helios\_web1b.count | default (‘2’) }}”  
format=%02d  
register: sequence  
`

Nothing has worked so far. Any ideas would be awesome. Thank you.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [August 14, 2015, 3:49pm UTC](https://forum.ansible.com/t/set-default-when-using-an-undefined-variable-in-with-sequence/19020/2 "2015-08-14T15:49:56Z")

</div>

{{ (helios\_web1b|default(2)).count | default ('2') }}"
