host patterns doesn't work in group inventory

24 views
Skip to first unread message

Oliver markey

unread,
Mar 25, 2019, 3:51:56 AM3/25/19
to Ansible Project
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*
`


Brian Coca

unread,
Apr 22, 2019, 10:43:21 PM4/22/19
to Ansible Project
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.
--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages