-# Install Puppet
-unless ENV['RS_PROVISION'] == 'no'
- # This will install the latest available package on el and deb based
- # systems fail on windows and osx, and install via gem on other *nixes
- foss_opts = { :default_action => 'gem_install' }
+def install_bolt_on(hosts)
+ on(hosts, "/opt/puppetlabs/puppet/bin/gem install --source http://rubygems.delivery.puppetlabs.net bolt -v '> 0.0.1'", acceptable_exit_codes: [0, 1]).stdout
+end
+
+def pe_install?
+ ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i
+end
+
+run_puppet_install_helper
+install_bolt_on(hosts) unless pe_install?
+install_module_on(hosts)
+install_module_dependencies_on(hosts)
+
+UNSUPPORTED_PLATFORMS = %w[RedHat Suse windows AIX Solaris].freeze
+
+DEFAULT_PASSWORD = if default[:hypervisor] == 'vagrant'
+ 'vagrant'
+ elsif default[:hypervisor] == 'vcloud'
+ 'Qu@lity!'
+ end
+
+def puppet_version
+ (on default, puppet('--version')).output.chomp
+end
+
+def run_puppet_access_login(user:, password:
+ '~!@#$%^*-/ aZ', lifetime: '5y')
+ on(master, puppet('access', 'login', '--username', user, '--lifetime', lifetime), stdin: password)
+end