Sha256: 8626e3f92e246103d9eb70d6798caadb6f440381f5c37136a1a30ec1103e2a05

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

# Custom tasks for centos OS profiles
namespace :centos do
    
  desc "Setup centos for web"
  task :setup_for_web do
    put template.load("centos/sudoers"), "/tmp/sudoers"
    script.sh("centos/setup_for_web.sh")
  end  
    
  desc "Cleanup"
  task :cleanup do
    yum.clean
    # TODO: Add cleanup tasks here
  end
  
  # Add user for an application
  desc "Add user (adds to admin group)"
  task :add_user_for_app do
    
    # Settings
    user = fetch(:user)
    fetch_or_default(:install_user, "root")
    
    with_user(install_user) do
    
      sudo "id sick || /usr/sbin/adduser -d #{deploy_to} -G admin #{user}"
      sudo "chmod a+rx #{deploy_to}"
  
      new_password = Capistrano::CLI.password_prompt("Password for user (#{user}): ")
  
      sudo "passwd #{user}" do |channel, stream, data|
        logger.info data
    
        if data =~ /password:/i
          channel.send_data "#{new_password}\n"
          channel.send_data "#{new_password}\n"
        end
      end
      
    end
        
  end
              
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capitate-0.1.8 lib/recipes/centos/centos.rb
capitate-0.1.9 lib/recipes/centos/centos.rb
capitate-0.1.7 lib/recipes/centos/centos.rb