class Ransible::Runner

HACK 別ファイルに切り出す

Public Class Methods

new(yml_path, inventory_path, options = {}) click to toggle source
# File lib/ransible.rb, line 6
  def initialize(yml_path, inventory_path, options = {})
@yml_path = yml_path
@inventory_path = inventory_path
@options = options
  end

Public Instance Methods

run() click to toggle source
# File lib/ransible.rb, line 12
  def run
log = run_ansible
p "executed ansible"
# HACK result = Result.new(log: log)のようにしたい
result = Result.new
result.log = log
result
  end

Private Instance Methods

run_ansible() click to toggle source
# File lib/ransible.rb, line 22
def run_ansible
  options = ''
  options = "--private-key #{@options[:private_key]}" if @options[:private_key].present?
  `ansible-playbook -i #{@inventory_path} #{@yml_path} #{options}`
end