ransible 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -2
- data/lib/ransible.rb +7 -3
- data/lib/ransible/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: cafb99c348d027bf7a943ef78adc4ad919baacec
|
4
|
+
data.tar.gz: 7cbfe69c28069dd4362d2b539d34211af1c96c80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 699b957e827b7fc6156f0a397c888350d344c32c4b2053b67b362e3c2ac8b63451ea5bfecada24f9a4aa183f5f3275f6205ecc818a6bc04c8964862c182777fa
|
7
|
+
data.tar.gz: 1d72ada8ff272996e012b632e0b581d19fcd18438436708f0cf8d071aec3fe9bcc19d3ca11003ffc4637d2c31c34c10f261f017416754da928e4b411c52d76bb
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ransible
|
2
2
|
|
3
|
-
|
3
|
+
Run Ansible from Ruby.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,9 +16,22 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install ransible
|
18
18
|
|
19
|
+
Install ansible with Homebrew:
|
20
|
+
|
21
|
+
$ brew install ansible
|
22
|
+
|
23
|
+
|
19
24
|
## Usage
|
20
25
|
|
21
|
-
|
26
|
+
Run ansible playbook.
|
27
|
+
|
28
|
+
```
|
29
|
+
result = Ransible::Runner.new('/path/to/playbook.yml', '/path/to/inventory').run
|
30
|
+
|
31
|
+
puts result.log
|
32
|
+
=> run playbook log.
|
33
|
+
```
|
34
|
+
|
22
35
|
|
23
36
|
## Contributing
|
24
37
|
|
data/lib/ransible.rb
CHANGED
@@ -3,14 +3,16 @@ require "ransible/version"
|
|
3
3
|
module Ransible
|
4
4
|
# HACK 別ファイルに切り出す
|
5
5
|
class Runner
|
6
|
-
def initialize(yml_path, inventory_path)
|
6
|
+
def initialize(yml_path, inventory_path, options = {})
|
7
7
|
@yml_path = yml_path
|
8
8
|
@inventory_path = inventory_path
|
9
|
+
@options = options
|
9
10
|
end
|
10
11
|
|
11
12
|
def run
|
12
13
|
log = run_ansible
|
13
14
|
p "executed ansible"
|
15
|
+
# HACK result = Result.new(log: log)のようにしたい
|
14
16
|
result = Result.new
|
15
17
|
result.log = log
|
16
18
|
result
|
@@ -18,7 +20,9 @@ module Ransible
|
|
18
20
|
|
19
21
|
private
|
20
22
|
def run_ansible
|
21
|
-
|
23
|
+
options = ''
|
24
|
+
options = "--private-key #{@options[:private_key]}" if @options[:private_key].present?
|
25
|
+
`ansible-playbook -i #{@inventory_path} #{@yml_path} #{options}`
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
@@ -26,4 +30,4 @@ module Ransible
|
|
26
30
|
class Result
|
27
31
|
attr_accessor :log
|
28
32
|
end
|
29
|
-
end
|
33
|
+
end
|
data/lib/ransible/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ransible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a.harada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|