Sha256: 179998ba8f2a96ddbb38a3be3d775613f5126e25836e01cd5c3b32fcbee21e08

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

namespace :rubber do
  
  namespace :collectd do
  
    rubber.allow_optional_tasks(self)

    after "rubber:bootstrap", "rubber:collectd:bootstrap"
    after "deploy:restart", "rubber:collectd:restart_rubber_plugin"


    task :bootstrap, :roles => :collectd do
      exists = capture("echo $(grep Rubber /etc/collectd/collectd.conf 2> /dev/null)")
      if exists.strip.size == 0
        rubber.update_code_for_bootstrap

        rubber.run_config(:file => "role/collectd/", :force => true, :deploy_path => release_path)

        restart
      end
    end

    desc "Start collectd system monitoring"
    task :start, :roles => :collectd do
      rsudo "service collectd status || service collectd start"
    end
    
    desc "Stop collectd system monitoring"
    task :stop, :roles => :collectd do
      rsudo "service collectd stop || true"
    end
    
    desc "Restart collectd system monitoring"
    task :restart, :roles => :collectd do
      stop
      start
    end

    desc "Restart collectd rubber plugin"
    task :restart_rubber_plugin, :roles => :collectd do
      # Need to kill rubber collectd runner script to force collectd to restart
      # it after deploy so that the runner script gets the new paths
      rsudo "pkill -fn #{rubber_env.rubber_collectd_runner.sub(/./, '[\0]')} ; exit 0"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubber-2.2.4 templates/collectd/config/rubber/deploy-collectd.rb
rubber-2.2.3 templates/collectd/config/rubber/deploy-collectd.rb