Sha256: 97cb04612bd8bbaeee05f2cb5e218a9a2296c1ede1c6e45a932774ec6ec25638

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

# Copyright 2006-2008 by Mike Bailey. All rights reserved.
Capistrano::Configuration.instance(:must_exist).load do 
  namespace :deprec do
    namespace :iptables do
      
      set(:ssh_port) { 
        Capistrano::CLI.ui.ask "ssh port"
      }

      set(:port_list) {(Capistrano::CLI.ui.ask "Enter a comma separated list of ports to ALLOW").split(',')}
      
      set(:iptables_rules) {'/etc/iptables.up.rules'}
      set(:interfaces) {'/etc/network/interfaces'}
            
      SYSTEM_CONFIG_FILES[:iptables] = [

         {:template => "iptables.up.erb",
           :path => '/etc/iptables.up.rules',
           :mode => 0644,
           :owner => 'root:root'}
    
       ]

      desc "Generate configuration file(s) for memcached"
      task :config_gen do
        SYSTEM_CONFIG_FILES[:iptables].each do |file|
          deprec2.render_template(:iptables, file)
        end
      end
      
      desc 'Deploy configuration files(s) for iptables configuration' 
      task :config do
        deprec2.push_configs(:iptables, SYSTEM_CONFIG_FILES[:iptables])
      end
      
      desc "Generate configuration file(s) for tables"
      task :config_gen do
        SYSTEM_CONFIG_FILES[:iptables].each do |file|
          deprec2.render_template(:iptables, file)
        end
      end

      desc "Load iptables rules and restart networking"
      task :activate_system do
        deprec2.append_to_file_if_missing(interfaces, "pre-up iptables-restore #{iptables_rules}")
        sudo "/etc/init.d/networking restart"
      end
      
      
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Empact-deprec-1.99.21 lib/deprec/recipes/iptables.rb