ransible 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99de986aa31ceaec0e2c0d2413b1adc479333665
4
- data.tar.gz: e06e87253c4c6c0067639f1e4c46cffaf56d2432
3
+ metadata.gz: cafb99c348d027bf7a943ef78adc4ad919baacec
4
+ data.tar.gz: 7cbfe69c28069dd4362d2b539d34211af1c96c80
5
5
  SHA512:
6
- metadata.gz: 1c03e806e6320fd47069b2291d18caec0c51a948022e440a4f0db2ae90748dbf3d05348afd5f2f1d8297cf6e6bf0bb03602d407d4e212269f5aa4f6d605171e2
7
- data.tar.gz: 6c799af7d1f8e0691adc81a905d07d62d4b01a8c7d89d354c335c71ac316a1b82266234ca3c3206a6f914c2c68c0961af41085e5e812f3db66ab9963bbaaba67
6
+ metadata.gz: 699b957e827b7fc6156f0a397c888350d344c32c4b2053b67b362e3c2ac8b63451ea5bfecada24f9a4aa183f5f3275f6205ecc818a6bc04c8964862c182777fa
7
+ data.tar.gz: 1d72ada8ff272996e012b632e0b581d19fcd18438436708f0cf8d071aec3fe9bcc19d3ca11003ffc4637d2c31c34c10f261f017416754da928e4b411c52d76bb
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ransible
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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
 
@@ -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
- `ansible-playbook -i #{@inventory_path} #{@yml_path}`
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
@@ -1,3 +1,3 @@
1
1
  module Ransible
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-01-21 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler