Module: Phase::DSL
- Defined in:
- lib/phase/dsl.rb
Instance Method Summary collapse
- #on_servers_through_bastion(bastion, servers, options = {}, &block) ⇒ Object
-
#run_remotely(options = {}, &block) ⇒ void
Runs a command on servers with the given role.
Instance Method Details
#on_servers_through_bastion(bastion, servers, options = {}, &block) ⇒ Object
27 28 29 |
# File 'lib/phase/dsl.rb', line 27 def on_servers_through_bastion(bastion, servers, = {}, &block) ::Phase::Kit::SSH::BastionCoordinator.new(bastion, hosts).run!(, &block) end |
#run_remotely(options = {}, &block) ⇒ void
This method returns an undefined value.
Runs a command on servers with the given role.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/phase/dsl.rb', line 14 def run_remotely( = {}, &block) = .extract!(:role_name, :environment, :user) servers = ::Phase.servers.where() if .has_key?(:bastion) && bastion = .delete(:bastion) hosts = servers.map { |s| {user: [:user], hostname: s.resource.private_ip_address} } on_servers_through_bastion(bastion, servers, , &block) else hosts = servers.map { |s| {user: [:user], hostname: s.resource.dns_name} } on(hosts, , &block) end end |