# Is there any way to select a single host when using a pattern?

**URL:** <https://forum.ansible.com/t/is-there-any-way-to-select-a-single-host-when-using-a-pattern/28939>\
**Category:** Ansible Project\
**Created:** [November 5, 2018, 1:09am UTC](https://forum.ansible.com/t/is-there-any-way-to-select-a-single-host-when-using-a-pattern/28939 "2018-11-05T01:09:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [November 5, 2018, 1:09am UTC](https://forum.ansible.com/t/is-there-any-way-to-select-a-single-host-when-using-a-pattern/28939/1 "2018-11-05T01:09:50Z")

</div>

hosts: group\_a[0]

works, but this does not

hosts: group\_a:&group\_b[0]

is there any way to achieve the second without having to put `run_once` on every task?

---

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [November 5, 2018, 1:11am UTC](https://forum.ansible.com/t/is-there-any-way-to-select-a-single-host-when-using-a-pattern/28939/2 "2018-11-05T01:11:29Z")

</div>

Well, there is this

- run\_once: true  
block:
- …

But can it be done via the host pattern?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 5, 2018, 4:51pm UTC](https://forum.ansible.com/t/is-there-any-way-to-select-a-single-host-when-using-a-pattern/28939/3 "2018-11-05T16:51:21Z")

</div>

put run\_once at play level
