Sha256: c9abe06e53a1e4db1b4365387a648e87ae9c56d06f23e7ef5878495f9b3d3bce

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

module PoolParty
  module Provisioner
    class Slave < ProvisionerBase

      def install_tasks
        [ 
          setup_puppet,
          setup_configs
        ] << configure_tasks
      end

      def configure_tasks
        [          
          start_puppet
        ]
      end

      def setup_puppet
        <<-EOE
          if [ -z "$(grep -v '#' /etc/hosts | grep 'master')" ]; then echo "#{master_ip} puppet master" >> /etc/hosts; else echo "host already set"; fi
          cp #{Base.remote_storage_path}/namespaceauth.conf /etc/puppet/namespaceauth.conf
          echo 'DAEMON_OPTS="-w 120 –fqdn #{@instance.name} –server master"' > /etc/default/puppet
        EOE
      end

      def setup_configs
        <<-EOS          
          echo "#{open(File.join(template_directory, "puppet.conf")).read}" > /etc/puppet/puppet.conf        
        EOS
      end

      # /etc/init.d/puppetmasterd stop
      # puppetd --listen --fqdn #{@instance.name}
      def start_puppet
        <<-EOS
          ps aux | grep "puppetmasterd" | awk '{print $2}' | xargs kill
          rm -rf /etc/puppet/ssl*
          puppetd --test  2>&1 &
          rm -rf /etc/puppet/ssl*
        EOS
      end
      
      def master_ip
        @cloud.master.ip
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
auser-poolparty-0.2.22 lib/poolparty/helpers/provisioners/slave.rb
auser-poolparty-0.2.23 lib/poolparty/helpers/provisioners/slave.rb
auser-poolparty-0.2.24 lib/poolparty/helpers/provisioners/slave.rb
auser-poolparty-0.2.25 lib/poolparty/helpers/provisioners/slave.rb
auser-poolparty-0.2.26 lib/poolparty/helpers/provisioners/slave.rb