# host patterns doesn't work in group inventory

**URL:** <https://forum.ansible.com/t/host-patterns-doesnt-work-in-group-inventory/29971>\
**Category:** Ansible Project\
**Created:** [March 25, 2019, 7:51am UTC](https://forum.ansible.com/t/host-patterns-doesnt-work-in-group-inventory/29971 "2019-03-25T07:51:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oliver\_markey](https://avatars.discourse-cdn.com/v4/letter/o/a587f6/32.png) [@Oliver\_markey](https://forum.ansible.com/u/Oliver_markey)\
**Post date:** [March 25, 2019, 7:51am UTC](https://forum.ansible.com/t/host-patterns-doesnt-work-in-group-inventory/29971/1 "2019-03-25T07:51:56Z")

</div>

I got a predefined group `monitor` with many monitoring parameters that will be used in prometheus/alertmanager/node-exporter.

inventory/hosts  
`[monitor] 10.1.1.1 10.2.2.2 10.3.3.3`

group\_vars/monitor.yml

`

prometheus\_version: xxx

prometheus\_port: xxx  
`

playbooks/monitor.yml  
`

- hosts: monitor  
roles:
- {role: prometheus}  
`

There was a problem when using dynamic inventory. No hosts were selected when using host patterns in group inventory.  
`[monitor] us-west:!tags_k8s*:!tags_win*`

---

<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:** [April 23, 2019, 2:43am UTC](https://forum.ansible.com/t/host-patterns-doesnt-work-in-group-inventory/29971/2 "2019-04-23T02:43:04Z")

</div>

They were never meant to work in inventory, they are used to 'select  
FROM inventory' but not to define it.

See group\_by and 'constructed' inventory plugin instead.
