Class: Moose::Inventory::Operations::QueryInventory::GroupQueries
- Inherits:
-
BaseQuery
- Object
- BaseQuery
- Moose::Inventory::Operations::QueryInventory::GroupQueries
show all
- Defined in:
- lib/moose_inventory/operations/query_inventory/group_queries.rb
Overview
Group-focused read queries.
Instance Method Summary
collapse
Methods inherited from BaseQuery
#initialize
Instance Method Details
#get_groups(names:) ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/moose_inventory/operations/query_inventory/group_queries.rb', line 9
def get_groups(names:)
names.each_with_object({}) do |name, results|
group = context.find_group(name)
next if group.nil?
results[group.name.to_sym] = group_data(group)
end
end
|
#list_group_vars(names:, ansible:) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/moose_inventory/operations/query_inventory/group_queries.rb', line 27
def list_group_vars(names:, ansible:)
return {} if names.empty?
return ansible_group_vars(names.first) if ansible
names.each_with_object({}) do |name, results|
group = context.find_group(name)
next if group.nil?
results[name.to_sym] = variables_hash(group.groupvars_dataset)
end
end
|
#list_groups(ansible:) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/moose_inventory/operations/query_inventory/group_queries.rb', line 18
def list_groups(ansible:)
context.all_groups.each_with_object({}) do |group, results|
hosts = group.hosts_dataset.map(:name)
next if hide_empty_automatic_group?(group, hosts)
results[group.name.to_sym] = list_group_data(group, hosts, ansible: ansible)
end
end
|