Sha256: 3de60c89f74821c2f272ee8ab8661c9add08f2a65aca145ec6a96f046fcb7812

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

require 'deprec-core'
Capistrano::Configuration.instance(:must_exist).load do 
  namespace :deprec do 
    namespace :logrotate do

      # Install      

      desc "Install logrotate"
      task :install do
        install_deps
        SYSTEM_CONFIG_FILES[:logrotate].each do |file|
          deprec2.render_template(:logrotate, file.merge(:remote => true))
        end
      end

      # install dependencies for nginx
      task :install_deps do
        apt.install( {:base => %w(logrotate)}, :stable )
      end

      # Configure

      SYSTEM_CONFIG_FILES[:logrotate] = [

        {:template => 'logrotate.conf.erb',
          :path => '/etc/logrotate.conf',
          :mode => 0755,
          :owner => 'root:root'}
      ]

      desc "Generate logrotate config from template."
      task :config_gen do
        SYSTEM_CONFIG_FILES[:logrotate].each do |file|
          deprec2.render_template(:logrotate, file)
        end
      end

      desc "Push logrotate config files to server"
      task :config do
        deprec2.push_configs(:logrotate, SYSTEM_CONFIG_FILES[:logrotate])
      end

      # Control
      #
      # logrotate is run via cron with a script in /etc/cron.daily/logrotate 
      
      desc "Force logrotate to run"
      task :force do
        sudo "logrotate -f /etc/logrotate.conf"
      end

    end 
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
deprec-3.1.0.rc16 lib/deprec/recipes/logrotate.rb
deprec-3.1.0.rc15 lib/deprec/recipes/logrotate.rb
deprec-3.1.0.rc13 lib/deprec/recipes/logrotate.rb
deprec-3.1.0.rc12 lib/deprec/recipes/logrotate.rb
deprec-3.1.0.rc11 lib/deprec/recipes/logrotate.rb