# with\_items and with\_sequence used together

**URL:** <https://forum.ansible.com/t/with-items-and-with-sequence-used-together/22693>\
**Category:** Ansible Project\
**Created:** [September 30, 2016, 8:02pm UTC](https://forum.ansible.com/t/with-items-and-with-sequence-used-together/22693 "2016-09-30T20:02:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Stobie](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@Christopher\_Stobie](https://forum.ansible.com/u/Christopher_Stobie)\
**Post date:** [September 30, 2016, 8:02pm UTC](https://forum.ansible.com/t/with-items-and-with-sequence-used-together/22693/1 "2016-09-30T20:02:03Z")

</div>

Is this currently possible?

---

<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:** [September 30, 2016, 9:16pm UTC](https://forum.ansible.com/t/with-items-and-with-sequence-used-together/22693/2 "2016-09-30T21:16:55Z")

</div>

There can only be 1 `with_` per task, but the 2nd part is a lookup (with\_), which you can stack in other ways.

with\_items:

- “{{lookup(‘sequence’, …)}}”

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [October 4, 2016, 1:53pm UTC](https://forum.ansible.com/t/with-items-and-with-sequence-used-together/22693/3 "2016-10-04T13:53:03Z")

</div>

lookup('sequence', ....) looks very handy for something I need to implement

that is a really ugly currently (include + with\_flattened +  
loop\_control + loop\_var).

Is the use of that documented anywhere?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 4, 2016, 3:16pm UTC](https://forum.ansible.com/t/with-items-and-with-sequence-used-together/22693/4 "2016-10-04T15:16:58Z")

</div>

Seams to be only documented in the code  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/sequence.py#L43-L79](https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/sequence.py#L43-L79)
