-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinv.yml
51 lines (48 loc) · 1.85 KB
/
inv.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Define your methods of grouping hosts in ansible dynamically here
## Input (REQUIRED)
# Input data source
# Map Data from a given source to ansible friendly groups
Input:
# Input name, can be anything
# Multiple input names can be added whem multiple queries are required, or different grouping.
# For instance, the below groups by Model, you may want to group by DNS, or site, or some other attributes.
netdisco_switches_by_model:
# Type
type: psql
# Database name
dbname: netdisco
# Database information
host: [your database host]
user: [your database user]
password: [your database password]
# Query to retrieve information
# PSQL Objects map fields from sql -> fields in inventory
select: "SELECT dns,model,vendor FROM device
WHERE model IS NOT NULL AND model != '' AND dns != ''
AND model NOT LIKE '.%'
AND last_discover > NOW() - INTERVAL '10 days'
ORDER BY model"
# Format of ansible group field. Any rows that have identical group_fields are grouped together.
group_field: '{{ model }}'
# Field that contains actual host
host_field: dns
# Host_vars maps extra column data to host variables, usable within playbooks
host_vars:
# Column from database to retrieve
- column: vendor
# Name of hostvar
var: vendor
# Output types
# By default, all outputs will be run
Output:
# Identifier, can be anything
ansible:
# Type of output
type: AnsibleJSON
ansibleini:
type: AnsibleINI
# Optional: File specifies an output file
# Note: File should always be set unless debugging or a one-off manual run, setting ansibleini output without a file
# breaks the stdout formatting that ansible requires
# This will write the output to a file instead of to stdout
file: C:\Temp\ansibleini.txt