Class: Subspace::Commands::Exec
- Defined in:
- lib/subspace/commands/exec.rb
Constant Summary collapse
- PASS_THROUGH_PARAMS =
["i"]
Instance Method Summary collapse
-
#initialize(args, options) ⇒ Exec
constructor
A new instance of Exec.
- #run ⇒ Object
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, ) @host_spec = args[0] @command = args[1] @user = .user @options = run end |
Instance Method Details
#run ⇒ Object
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 |