zinv 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/zinv.rb +218 -0
- data/lib/zinv.rb +5 -0
- data/lib/zinv/version.rb +3 -0
- data/zinv.gemspec +34 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86314f00d9a9972624e43251f0229d59db862cfc
|
4
|
+
data.tar.gz: 290eeae1e53e7aaa8b15c670153fc5cc909969d9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 313efc1d49516bf8bf32d31c2c733d60b80ca2220037e832e16f000a4e5c17c3c70af0cabd3f3f3a85c4da8e5efcfed894eaf903263e29450021998eea9a4d5e
|
7
|
+
data.tar.gz: aba6e685e120f0e5b05d1ef09f1b86a74329fc204aad85c31ea034e0d29b60a6a532c720d73867980d18a41e9d6da8b19cd2a3aa116f373994b267fdf142f91b
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at TODO: Write your email address. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Dave Parker
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Zinv
|
2
|
+
|
3
|
+
zinv.rb generates a dynamic inventory structure for Ansible based on your Zabbix installation's data. It generates groups based on both host groups and templates by collecting all hosts that use templates directly or indirectly derived from a template list you provide in an environment variable. It also provides a small "hook" for the addition of hosts that are not yet defined in Zabbix.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'zinv'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install zinv
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
To use zinv.rb you must (by one of the several methods available) tell Ansible to use zinv.rb as its inventory. Having done that, define the following environment variables for zinv.rb to work properly:
|
24
|
+
|
25
|
+
* ZINV_ZABBIX_URL = your zabbix web interface URL
|
26
|
+
* ZINV_ZABBIX_USER = user to log into zabbix as
|
27
|
+
* ZINV_ZABBIX_PASS = password for that user
|
28
|
+
|
29
|
+
|
30
|
+
zinv.rb by default uses the following templates as its "root" ones:
|
31
|
+
|
32
|
+
* Template OS Linux
|
33
|
+
* Template OS Linux Active
|
34
|
+
* Template SNMP OS Linux
|
35
|
+
|
36
|
+
You can override this by setting the following:
|
37
|
+
|
38
|
+
* ZINV_ROOT_TEMPLATES = comma separated list of 'root' templates to seed template tree generation (optional)
|
39
|
+
|
40
|
+
You can insert hosts into the inventory "manually" by setting the following:
|
41
|
+
|
42
|
+
* ZINV_ADD_HOSTS = comma separated list of host names to inject into the inventory under group New_Hosts
|
43
|
+
|
44
|
+
In all cases, zinv.rb presumes that the host names it's getting from zabbix (or you, in the case of ZINV_ADD_HOSTS) are resolvable by the host you're running ansible on. Which is to say if you have a host called myhost1, you should be able to ping myhost1 on the ansible machine. The implication is that you've either defined all your host names as fqdns in Zabbix, or you've set up your resolver search list properly.
|
45
|
+
|
46
|
+
|
47
|
+
## Development
|
48
|
+
|
49
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
50
|
+
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zinv. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
56
|
+
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
61
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "zinv"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/zinv.rb
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'zabbixapi'
|
3
|
+
require 'json'
|
4
|
+
require 'trollop'
|
5
|
+
require 'awesome_print'
|
6
|
+
require 'set'
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
if not (ENV['ZINV_ZABBIX_URL'] and ENV['ZINV_ZABBIX_USER'] and ENV['ZINV_ZABBIX_PASS'])
|
13
|
+
puts "\nYou *must* define the following environment variables for zinv.rb to work properly:\n\n"
|
14
|
+
puts "ZINV_ZABBIX_URL = your zabbix web interface URL"
|
15
|
+
puts "ZINV_ZABBIX_USER = user to log into zabbix as"
|
16
|
+
puts "ZINV_ZABBIX_PASS = password for that user\n\n"
|
17
|
+
puts "OPTIONAL variables are:"
|
18
|
+
puts "ZINV_ROOT_TEMPLATES = comma separated list of 'root' templates to seed template tree generation (optional)"
|
19
|
+
puts "ZINV_ADD_HOSTS = comma separated list of host names to inject into the inventory under group New_Hosts"
|
20
|
+
puts "\nExiting"
|
21
|
+
exit(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# This list forms the basis for the collection of hosts and
|
28
|
+
# templates included in inventory. Any template directly or
|
29
|
+
# indirectly derived from these will be included. Any host
|
30
|
+
# using any of the included templates will be included.
|
31
|
+
|
32
|
+
roottemplatenames = [
|
33
|
+
'Template OS Linux',
|
34
|
+
'Template OS Linux Active',
|
35
|
+
'Template SNMP OS Linux'
|
36
|
+
]
|
37
|
+
|
38
|
+
if ENV['ZINV_ROOT_TEMPLATES']
|
39
|
+
roottemplatenames = ENV['ZINV_ROOT_TEMPLATES'].split(',')
|
40
|
+
end
|
41
|
+
|
42
|
+
# Assign a comma separated list of host names to this before running
|
43
|
+
# ansible-playbook to have hosts not yet in zabbix listed in inventory
|
44
|
+
runtimehostvar = 'ZINV_ADD_HOSTS'
|
45
|
+
|
46
|
+
opts = Trollop::options do
|
47
|
+
opt :list, "List entire inventory" # required by ansible
|
48
|
+
opt :host, "List a single host", :type => :string # required by ansible
|
49
|
+
opt :debug, "Debugging verbosity"
|
50
|
+
opt :groups, "Dump groups list"
|
51
|
+
opt :templates, "Dump templates list"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Generate an in-memory host group with the comma delim list in this env var
|
55
|
+
if ENV[runtimehostvar]
|
56
|
+
newhostnamelist = ENV[runtimehostvar].split(',')
|
57
|
+
else
|
58
|
+
newhostnamelist = Array.new
|
59
|
+
end
|
60
|
+
|
61
|
+
# This is here just to satisfy the spec. This script generates a top level
|
62
|
+
# _meta element which deprecates the requirement so this is basically
|
63
|
+
# dead code.
|
64
|
+
if opts[:host]
|
65
|
+
puts Hash.new.to_json
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
69
|
+
# Connect to zabbix.
|
70
|
+
zbx = ZabbixApi.connect(
|
71
|
+
:url => "#{ENV['ZINV_ZABBIX_URL']}/api_jsonrpc.php",
|
72
|
+
:user => ENV['ZINV_ZABBIX_USER'],
|
73
|
+
:password => ENV['ZINV_ZABBIX_PASS'],
|
74
|
+
:debug => opts[:debug]
|
75
|
+
)
|
76
|
+
|
77
|
+
|
78
|
+
# Get all the root template objects
|
79
|
+
roottemplates = zbx.query(
|
80
|
+
:method => 'template.get',
|
81
|
+
:params => {
|
82
|
+
:filter => {
|
83
|
+
:host => roottemplatenames
|
84
|
+
}
|
85
|
+
}
|
86
|
+
)
|
87
|
+
|
88
|
+
|
89
|
+
ansibletemplates = roottemplates # This list is used by host gathering logic later on
|
90
|
+
ansibletemplategroups = Hash.new # This holds hosts-by-template - rendered as inventory later
|
91
|
+
prevchunk = roottemplates # this is for the "walking the tree" logic
|
92
|
+
|
93
|
+
# Set up template groups for the root templates
|
94
|
+
prevchunk.each {|template|
|
95
|
+
name = template['name'].gsub(/[ ]/,'_')
|
96
|
+
if not ansibletemplategroups.has_key?(name)
|
97
|
+
ansibletemplategroups[name] = {'hosts' => Set.new}
|
98
|
+
end
|
99
|
+
}
|
100
|
+
|
101
|
+
# Find all templates that derive from the root ones, adding to ansibletemplates
|
102
|
+
# and ansibletemplategroups as we go
|
103
|
+
begin
|
104
|
+
nextchunk = zbx.query(
|
105
|
+
:method => 'template.get',
|
106
|
+
:params => {
|
107
|
+
:parentTemplateids => prevchunk.collect {|each| each['templateid']}
|
108
|
+
}
|
109
|
+
)
|
110
|
+
nextchunk.each {|template|
|
111
|
+
name = template['name'].gsub(/[ ]/,'_')
|
112
|
+
if not ansibletemplategroups.has_key?(name)
|
113
|
+
ansibletemplategroups[name] = {'hosts' => Set.new}
|
114
|
+
end
|
115
|
+
}
|
116
|
+
|
117
|
+
if nextchunk.size > 0
|
118
|
+
ansibletemplates += nextchunk
|
119
|
+
prevchunk = nextchunk
|
120
|
+
end
|
121
|
+
end while nextchunk.size > 0
|
122
|
+
|
123
|
+
# Also fudge up a container for all hosts. Probably not necessary as ansible does this
|
124
|
+
# for us
|
125
|
+
ansiblehostgroups = {'All_Hosts' => {'hosts' => Set.new}}
|
126
|
+
# And fudge up a group for whatever host names came at us from the environment variable above
|
127
|
+
ansiblehostgroups['New_Hosts'] = {'hosts' => newhostnamelist}
|
128
|
+
|
129
|
+
# This has will hold host variables from the notes field in zabbix's inventory for a host.
|
130
|
+
# We render this under the _meta top level entity below. By doing this we force
|
131
|
+
# ansible to *not* call --host <hostname> a gillion times, which saves a lot of time & cpu
|
132
|
+
metadata = Hash.new
|
133
|
+
|
134
|
+
|
135
|
+
# Gather all the hosts that use the templates we've collected. We'll put them in
|
136
|
+
# two types of hashes: host group hashes and template group hashes.
|
137
|
+
zbx.hostgroups.all.each { |name,id|
|
138
|
+
hostlist = Array.new
|
139
|
+
# Gather hosts using our templates, ensuring we also grab inventory for this host
|
140
|
+
hosts = zbx.query(
|
141
|
+
:method => 'host.get',
|
142
|
+
:params => {
|
143
|
+
:groupids => [id],
|
144
|
+
:templateids => ansibletemplates.collect {|each| each['templateid']},
|
145
|
+
:selectParentTemplates => [
|
146
|
+
'name'
|
147
|
+
],
|
148
|
+
:selectInventory => 'extend'
|
149
|
+
}
|
150
|
+
)
|
151
|
+
|
152
|
+
# For each host we've collected, add it to each group it belongs in (both host and template),
|
153
|
+
# but only if its inclusion in those groups is not overridded by the string DONOTMANAGE
|
154
|
+
# in the host's description field.
|
155
|
+
hosts.each { |host|
|
156
|
+
# You can put the string DONOTMANAGE anywhere in the zabbix host description
|
157
|
+
# If you do that the node in question will be excluded from inventory
|
158
|
+
if host['description'] !~ /DONOTMANAGE/
|
159
|
+
hostlist.push(host['host'])
|
160
|
+
host['parentTemplates'].each { |template|
|
161
|
+
templatename = template['name'].gsub(/[ ]/,'_')
|
162
|
+
if ansibletemplategroups.has_key?(templatename)
|
163
|
+
ansibletemplategroups[templatename]['hosts'].add(host['name'])
|
164
|
+
end
|
165
|
+
}
|
166
|
+
# If you need to define host variables, in the zabbix host definition select "Inventory" and put yaml in the Notes field.
|
167
|
+
# See the host "speedtest" for an example. First line should be '---', then each line after is "key: value"
|
168
|
+
# e.g.:
|
169
|
+
# ---
|
170
|
+
# ereiamjh: The ghost in the machine
|
171
|
+
# youshouldwatch: Brazil
|
172
|
+
#
|
173
|
+
if host.has_key?('inventory') and host['inventory'].class == Hash and host['inventory'].has_key?('notes') and host['inventory']['notes'].size > 0
|
174
|
+
begin
|
175
|
+
metadata[host['name']] = YAML.load(host['inventory']['notes'])
|
176
|
+
rescue Exception => e
|
177
|
+
puts "Error parsing inventory notes field for host #{host['name']} - SKIPPING"
|
178
|
+
ap e
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
}
|
184
|
+
|
185
|
+
if hostlist.size > 0
|
186
|
+
ansiblehostgroups[name.gsub(/[ ]/,'_')] = {'hosts'=>hostlist}
|
187
|
+
ansiblehostgroups['All_Hosts']['hosts'].merge(hostlist) # probably don't need this
|
188
|
+
end
|
189
|
+
}
|
190
|
+
|
191
|
+
# These are just for more informative dumps...
|
192
|
+
hostgroupcount = ansiblehostgroups.keys.size
|
193
|
+
if opts[:groups]
|
194
|
+
puts ansiblehostgroups.keys.sort.join("\n")
|
195
|
+
end
|
196
|
+
if opts[:templates]
|
197
|
+
puts ansibletemplategroups.keys.sort.join("\n")
|
198
|
+
end
|
199
|
+
templategroupcount = ansibletemplategroups.keys.size
|
200
|
+
ansiblehostgroups['All_Hosts']['hosts'] = ansiblehostgroups['All_Hosts']['hosts'].to_a
|
201
|
+
|
202
|
+
# Here we add the top level _meta element containing whatever host variables we might have
|
203
|
+
# defined in zabbix. This really *needs* to be here; minus this performance is just awful.
|
204
|
+
ansiblehostgroups['_meta'] = { 'hostvars' => metadata }
|
205
|
+
ansibletemplategroups.each { |k,v|
|
206
|
+
v['hosts'] = v['hosts'].to_a
|
207
|
+
if v['hosts'].size > 0
|
208
|
+
ansiblehostgroups[k] = v
|
209
|
+
end
|
210
|
+
}
|
211
|
+
if opts[:list] # This is the final output to ansible - the inventory
|
212
|
+
puts ansiblehostgroups.to_json
|
213
|
+
elsif not (opts[:groups] or opts[:templates]) # informative dump
|
214
|
+
ap ansiblehostgroups
|
215
|
+
puts "Root templates #{roottemplatenames.join(',')}"
|
216
|
+
puts "#{hostgroupcount} host groups, #{templategroupcount} template groups"
|
217
|
+
puts "#{ansiblehostgroups['All_Hosts']['hosts'].size} hosts total"
|
218
|
+
end
|
data/lib/zinv.rb
ADDED
data/lib/zinv/version.rb
ADDED
data/zinv.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'zinv/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zinv"
|
8
|
+
spec.version = Zinv::VERSION
|
9
|
+
spec.authors = ["Dave Parker"]
|
10
|
+
spec.email = ["david.parker _AT_ nsight.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ansible dynamic inventory script for hosts monitored by zabbix}
|
13
|
+
spec.homepage = "https://github.com/svdasein/zinv"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_runtime_dependency "zabbixapi", '~> 3.1'
|
32
|
+
spec.add_runtime_dependency "trollop", '~> 2.1'
|
33
|
+
spec.add_runtime_dependency "awesome_print", '~> 1.8'
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zinv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dave Parker
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: zabbixapi
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: trollop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: awesome_print
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.8'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.8'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- david.parker _AT_ nsight.com
|
86
|
+
executables:
|
87
|
+
- zinv.rb
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- CODE_OF_CONDUCT.md
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/console
|
98
|
+
- bin/setup
|
99
|
+
- exe/zinv.rb
|
100
|
+
- lib/zinv.rb
|
101
|
+
- lib/zinv/version.rb
|
102
|
+
- zinv.gemspec
|
103
|
+
homepage: https://github.com/svdasein/zinv
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata:
|
107
|
+
allowed_push_host: https://rubygems.org
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.5.1
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Ansible dynamic inventory script for hosts monitored by zabbix
|
128
|
+
test_files: []
|
129
|
+
has_rdoc:
|