Class: Rundock::Operation::Deploy

Inherits:
Base show all
Defined in:
lib/rundock/plugin/operation/deploy.rb

Overview

You can use this as following scenario.yml for example.

  • node: localhost

deploy:
  - src: /tmp/deploy_from_local_file
    dst: /tmp/deploy_dest_local_file
  - src: /tmp/deploy_from_local_dir
    dst: /tmp/deploy_dest_local_dir
  • node: anyhost-01

deploy:
  - src: /tmp/deploy_from_local_file
    dst: /tmp/deploy_dest_remote_file
  - src: /tmp/deploy_from_local_dir
    dst: /tmp/deploy_dest_remote_dir

anyhost-01:

host: 192.168.1.11
ssh_opts:
  port: 22
  user: anyuser
  key:  ~/.ssh/id_rsa

Constant Summary

Constants inherited from Base

Base::OperationNotImplementedError

Instance Attribute Summary

Attributes inherited from Base

#attributes, #instruction

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Rundock::Operation::Base

Instance Method Details

#run(backend, attributes) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/rundock/plugin/operation/deploy.rb', line 28

def run(backend, attributes)
  options = attributes[:deploy]

  options.each do |path|
    Logger.error('src: options not found.') if !path[:src] || path[:src].blank?
    Logger.error('dst: options not found.') if !path[:dst] || path[:dst].blank?
    Logger.info("deploy localhost:#{path[:src]} remote:#{attributes[:nodeinfo][:host]}:#{path[:dst]}")
    backend.send_file(path[:src], path[:dst])
  end
end