Class: Subspace::Commands::Exec

Inherits:
Base
  • Object
show all
Defined in:
lib/subspace/commands/exec.rb

Constant Summary collapse

PASS_THROUGH_PARAMS =
["i"]

Instance Method Summary collapse

Methods inherited from Base

#confirm_overwrite, #copy, #dest_dir, #gem_path, #inventory, #pass_through_params, #playbook_dir, #project_name, #project_path, #require_configuration, #set_subspace_version, #template, #template!, #template_dir

Methods included from Ansible

#ansible_command, #ansible_playbook

Constructor Details

#initialize(args, options) ⇒ Exec

Returns a new instance of Exec.



6
7
8
9
10
11
12
# File 'lib/subspace/commands/exec.rb', line 6

def initialize(args, options)
  @host_spec = args[0]
  @command = args[1]
  @user = options.user
  @options = options
  run
end

Instance Method Details

#runObject



14
15
16
17
18
19
# File 'lib/subspace/commands/exec.rb', line 14

def run
  hosts = inventory.find_hosts!(@host_spec)

  say "> Running `#{@command}` on #{hosts.join ','}"
  ansible_command "ansible", @host_spec, "-m", "command", "-a", @command
end