<commit_before>set :puppet_path, "#{recipes_path}/capi5k-puppetcluster"

load "#{puppet_path}/roles.rb"
load "#{puppet_path}/roles_definition.rb"
load "#{puppet_path}/output.rb"

set :proxy, "https_proxy=http://proxy:3128 http_proxy=http://proxy:3128"
set :apt_get_p, "#{proxy} apt-get"

PUPPET_VERSION=puppet_version

namespace :puppetcluster do
  
  desc 'Install a puppet cluster' 
  task :default, :on_error => :continue do
    puppet
    master::default
    clients::default
    sign_all
  end

  task :puppet, :roles => [:puppet_master, :puppet_clients] do
    set :user, "root"
    env = "PUPPET_VERSION=#{PUPPET_VERSION}"
    env += " #{proxy}"
    run "#{apt_get_p} update && #{apt_get_p} install -y curl" 
    # TODO fix ubuntu 1404
    run "#{apt_get_p} install -y rubygems" 
    run "#{proxy} curl -L https://raw.github.com/pmorillon/puppet-puppet/master/files/scripts/puppet_install.sh | #{env} sh"
  end

  namespace :master do

    desc 'Install the puppet master'
    task :default do
      install
      ip
    end

    task :install, :roles => [:puppet_master],  :on_error => :continue do
      set :user, "root"
      run "apt-get -y install puppetmaster=#{PUPPET_VERSION}-1puppetlabs1 puppetmaster-common=#{PUPPET_VERSION}-1puppetlabs1"
      run "puppet agent -t"
    end

    task :ip, :roles => [:puppet_master] do
      ip = capture("facter ipaddress")
      puts ip
      File.write("tmp/ipmaster", ip)
    end

  end

  namespace :clients do 
    <commit_msg>fix puppet bootstrap path.<commit_after>set :puppet_path, "#{recipes_path}/capi5k-puppetcluster"

load "#{puppet_path}/roles.rb"
load "#{puppet_path}/roles_definition.rb"
load "#{puppet_path}/output.rb"

set :proxy, "https_proxy=http://proxy:3128 http_proxy=http://proxy:3128"
set :apt_get_p, "#{proxy} apt-get"

PUPPET_VERSION=puppet_version

namespace :puppetcluster do
  
  desc 'Install a puppet cluster' 
  task :default, :on_error => :continue do
    rubygems
    puppet
    master::default
    clients::default
    sign_all
  end
  
  task :rubygems, :roles => [:puppet_master, :puppet_clients], :on_error => :continue do
    set :user, "root"
    run "#{apt_get_p} install -y rubygems" 
  end


  task :puppet, :roles => [:puppet_master, :puppet_clients] do
    set :user, "root"
    env = "PUPPET_VERSION=#{PUPPET_VERSION}"
    env += " #{proxy}"
    run "#{apt_get_p} update && #{apt_get_p} install -y curl" 
    run "#{proxy} https://raw.githubusercontent.com/pmorillon/puppet-puppet/master/extras/bootstrap/puppet_install.sh | #{env} sh"
  end

  namespace :master do

    desc 'Install the puppet master'
    task :default do
      install
      ip
    end

    task :install, :roles => [:puppet_master],  :on_error => :continue do
      set :user, "root"
      run "apt-get -y install puppetmaster=#{PUPPET_VERSION}-1puppetlabs1 puppetmaster-common=#{PUPPET_VERSION}-1puppetlabs1"
      run "puppet agent -t"
    end

    task :ip, :roles => [:puppet_master] do
      ip = capture("facter ipaddress")
      puts ip
      File.write("tmp/ipmaster", ip)
    end

  end

  namespace :clients do 
    
{'fraction_non_alphanumeric': 0.13372093023255813, 'fraction_numerical': 0.009689922480620155, 'mean_word_length': 3.501453488372093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '38881', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1156, 'n_words': 260}