koma 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -0
- data/lib/koma/backend/base.rb +1 -1
- data/lib/koma/cli.rb +7 -6
- data/lib/koma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e32b642be41676c51afc7f85a8b59b5187de12bb
|
4
|
+
data.tar.gz: e3756595e53e4524f36622e1f270e5aa69711789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 644d63e5d096efe79533342e9631873b7249d0c665d9ad081bccddd6adae20e51a849bf7890c9e9bb99e00dd5a8df6947b9b7507f11991820aab85f93b119486
|
7
|
+
data.tar.gz: 34892ac818069131b3d9e9576a29c4894bc9a007c5d6104989743e9163044732d3ffb891a512a2cac726e72b7c95066fd2ba610526252293b2360afbfb04b20b
|
data/README.md
CHANGED
@@ -24,6 +24,8 @@ $ gem install koma
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
+
### Gather remote host inventory
|
28
|
+
|
27
29
|
If you login remote server via `ssh example.com`, you can execute:
|
28
30
|
|
29
31
|
```sh
|
@@ -32,6 +34,12 @@ $ koma ssh example.com
|
|
32
34
|
|
33
35
|
And gather host inventory stdout like [this](stdout_sample.json).
|
34
36
|
|
37
|
+
### Gather local host inventory
|
38
|
+
|
39
|
+
```sh
|
40
|
+
$ koma exec
|
41
|
+
```
|
42
|
+
|
35
43
|
### Gather host inventory from multiple hosts
|
36
44
|
|
37
45
|
```sh
|
@@ -78,6 +86,29 @@ Gather vagrant host inventory.
|
|
78
86
|
$ vagrant ssh-config | koma ssh --key cpu,kernel
|
79
87
|
```
|
80
88
|
|
89
|
+
### Run command on remote hosts
|
90
|
+
|
91
|
+
```sh
|
92
|
+
$ koma run-command example.com,example.jp uptime
|
93
|
+
{
|
94
|
+
"example.com": {
|
95
|
+
"uptime": {
|
96
|
+
"exit_signal": null,
|
97
|
+
"exit_status": 0,
|
98
|
+
"stderr": "",
|
99
|
+
"stdout": " 00:18:10 up 337 days, 4:51, 1 user, load average: 0.08, 0.02, 0.01\n"
|
100
|
+
}
|
101
|
+
},
|
102
|
+
"example.jp": {
|
103
|
+
"uptime": {
|
104
|
+
"exit_signal": null,
|
105
|
+
"exit_status": 0,
|
106
|
+
"stderr": "",
|
107
|
+
"stdout": " 00:10:09 up 182 days, 7:34, 1 user, load average: 0.07, 0.03, 0.01\n"
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
```
|
81
112
|
|
82
113
|
## Host inventory keys
|
83
114
|
|
data/lib/koma/backend/base.rb
CHANGED
data/lib/koma/cli.rb
CHANGED
@@ -4,13 +4,15 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
module Koma
|
6
6
|
class CLI < Thor
|
7
|
+
class_option :version, type: :boolean, aliases: :V
|
8
|
+
|
7
9
|
desc 'ssh <host1,host2,..>', 'stdout remote host inventory'
|
8
10
|
option :key, type: :string, banner: '<key1,key2,..>', desc: 'inventory keys', aliases: :k
|
9
11
|
option :yaml, type: :boolean, desc: 'stdout YAML', aliases: :Y
|
10
12
|
option :identity_file, type: :string, banner: '<identity_file>', desc: 'identity file', aliases: :i
|
11
13
|
option :port, type: :numeric, banner: '<port>', desc: 'port', aliases: :p
|
12
14
|
Koma::HostInventory.disabled_keys.each do |key|
|
13
|
-
option "
|
15
|
+
option "enable-#{key}", type: :boolean, desc: "enable #{key}"
|
14
16
|
end
|
15
17
|
def ssh(host = nil)
|
16
18
|
if host.nil?
|
@@ -34,7 +36,7 @@ module Koma
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
desc 'run-command <host1,host2,..> <command1> <command2> ...', 'run command on
|
39
|
+
desc 'run-command <host1,host2,..> <command1> <command2> ...', 'run command on remote hosts'
|
38
40
|
option :yaml, type: :boolean, desc: 'stdout YAML', aliases: :Y
|
39
41
|
option :identity_file, type: :string, banner: '<identity_file>', desc: 'identity file', aliases: :i
|
40
42
|
option :port, type: :numeric, banner: '<port>', desc: 'port', aliases: :p
|
@@ -75,7 +77,7 @@ module Koma
|
|
75
77
|
option :key, type: :string, banner: '<key1,key2,..>', desc: 'inventory keys', aliases: :k
|
76
78
|
option :yaml, type: :boolean, desc: 'stdout YAML', aliases: :Y
|
77
79
|
Koma::HostInventory.disabled_keys.each do |key|
|
78
|
-
option "
|
80
|
+
option "enable-#{key}", type: :boolean, desc: "enable #{key}"
|
79
81
|
end
|
80
82
|
def exec
|
81
83
|
backend = Koma::Backend::Exec.new(nil, options)
|
@@ -94,9 +96,8 @@ module Koma
|
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
97
|
-
|
98
|
-
|
99
|
-
if version
|
99
|
+
def help(command = nil)
|
100
|
+
if options[:version]
|
100
101
|
puts Koma::VERSION
|
101
102
|
else
|
102
103
|
super
|
data/lib/koma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: koma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|