Sha256: 861040959ddc89456fe31a24f70c19908ccc9fd29d5089dcd93c965d080c54a6

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

namespace :monit do
  
  namespace :centos do

    desc <<-DESC
    Install monit.
    
    *monit_build_options*: Monit build options.\n
    *monit_port*: Monit port. _Defaults to 2812_\n    
    @set :monit_port, 2812@\n
    *monit_password*: Monit password. _Defaults to password prompt_\n    
    @set :monit_password, prompt.password('Monit admin password (to set): ')@\n    
    *monit_conf_dir*: Directory for monitrc files.\n    
    @set :monit_conf_dir, "/etc/monit"@\n      
    DESC
    task :install do
      
      # Settings
      fetch_or_default(:monit_port, 2812)
      fetch_or_default(:monit_password, prompt.password('Monit admin password (to set): ', true))
      fetch_or_default(:monit_conf_dir, "/etc/monit")
      fetch(:monit_build_options)
        
      # Install dependencies
      yum.install([ "flex", "byacc" ])
        
      # Build
      script.make_install("monit", monit_build_options)

      # Install initscript
      put template.load("monit/monit.initd.centos.erb"), "/tmp/monit.initd"
      run_via "install -o root /tmp/monit.initd /etc/init.d/monit && rm -f /tmp/monit.initd"

      # Install monitrc
      put template.load("monit/monitrc.erb"), "/tmp/monitrc"
      run_via "mkdir -p #{monit_conf_dir} && install -o root -m 700 /tmp/monitrc /etc/monitrc && rm -f /tmp/monitrc"

      # Patch initab
      script.sh("monit/patch_inittab.sh")

      # Build cert
      put template.load("monit/monit.cnf"), "/tmp/monit.cnf"
      script.sh("monit/cert.sh")
    end

  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capitate-0.2.1 lib/recipes/centos/monit.rb
capitate-0.2.2 lib/recipes/centos/monit.rb