Module: Capistrano::Puppeteer::Puppet

Defined in:
lib/capistrano/puppeteer/puppet.rb

Class Method Summary collapse

Class Method Details

.extended(configuration) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/capistrano/puppeteer/puppet.rb', line 5

def self.extended(configuration)
  configuration.load do
    unless exists? :puppet_path
      set(:puppet_path) { '/srv/puppet' } unless exists? :puppet_path
    end

    namespace :puppet do
      task :update do
        system 'git push'
        run "#{sudo} chgrp -R adm #{puppet_path}"
        run "#{sudo} chmod -R g+rw #{puppet_path}"
        run "cd #{puppet_path} && git pull --quiet"
      end

      desc <<-DESC
      Perform a puppet run.

      Pass options to puppt using OPTIONS

      puppet:go options="--noop"
      DESC
      task :go do
        update
        options = ENV['options'] || ENV['OPTIONS'] || ''
        run "cd #{puppet_path} && #{sudo} puppet apply --config puppet.conf --verbose #{options} manifests/site.pp"
      end
    end
  end
end