Skip to content
This repository has been archived by the owner on Jul 9, 2020. It is now read-only.

Commit

Permalink
add support for Puppet 5 agent installs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoll committed Aug 31, 2017
1 parent 3111089 commit 1207a19
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion provisioning_templates/provision/autoyast_sles_default.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ oses:
os_minor = @host.operatingsystem.minor.to_i
# safemode renderer does not support unary negation
pm_set = @host.puppetmaster.empty? ? false : true
aio_enabled = host_param_true?('enable-puppetlabs-puppet5-repo') || host_param_true?('enable-puppetlabs-pc1-repo') || host_param_true?('enable-puppet4') || host_param_true?('enable-puppet5')
puppet_enabled = pm_set || host_param_true?('force-puppet')
salt_enabled = host_param('salt_master') ? true : false
sles_minor_string = (os_minor == 0) ? '' : "_SP#{os_minor}"
Expand Down Expand Up @@ -123,7 +124,7 @@ oses:
<package>lsb-release</package>
<package>openssh</package>
<% if puppet_enabled -%>
<% if host_param_true?('enable-puppetlabs-pc1-repo') -%>
<% if aio_enabled -%>
<package>puppet-agent</package>
<% else -%>
<package>rubygem-puppet</package>
Expand Down
5 changes: 4 additions & 1 deletion provisioning_templates/snippet/puppet.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ name: puppet.conf
os_family = @host.operatingsystem.family
os_name = @host.operatingsystem.name

if (host_param_true?('enable-puppetlabs-pc1-repo') || host_param_true?('enable-puppet4')) && (os_family == 'Debian' || os_family == 'Redhat' || os_name == 'SLES')
aio_enabled = host_param_true?('enable-puppetlabs-puppet5-repo') || host_param_true?('enable-puppetlabs-pc1-repo') || host_param_true?('enable-puppet4') || host_param_true?('enable-puppet5')
aio_available = os_family == 'Debian' || os_family == 'Redhat' || os_name == 'SLES'

if aio_enabled && aio_available
var_dir = '/opt/puppetlabs/puppet/cache'
log_dir = '/var/log/puppetlabs/puppet'
run_dir = '/var/run/puppetlabs'
Expand Down
10 changes: 6 additions & 4 deletions provisioning_templates/snippet/puppet_setup.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ os_family = @host.operatingsystem.family
os_major = @host.operatingsystem.major.to_i
os_name = @host.operatingsystem.name

aio_enabled = host_param_true?('enable-puppetlabs-puppet5-repo') || host_param_true?('enable-puppetlabs-pc1-repo') || host_param_true?('enable-puppet4') || host_param_true?('enable-puppet5')

if os_family == 'Freebsd'
freebsd_package = 'puppet4'
freebsd_package = host_param_true?('enable-puppet5') ? 'puppet5' : 'puppet4'
etc_path = '/usr/local/etc/puppet'
bin_path = '/usr/local/bin'
elsif os_family == 'Windows'
windows_package = "puppet-agent-#{@host.architecture}.msi"
etc_path = 'C:\ProgramData\PuppetLabs\puppet\etc'
bin_path = 'C:\Program Files\Puppet Labs\Puppet\bin'
elsif host_param_true?('enable-puppetlabs-pc1-repo') || host_param_true?('enable-puppet4')
elsif aio_enabled
linux_package = 'puppet-agent'
etc_path = '/etc/puppetlabs/puppet'
bin_path = '/opt/puppetlabs/bin'
Expand All @@ -39,7 +41,7 @@ else
yum -t -y install <%= linux_package %>
fi
<% elsif os_family == 'Suse' -%>
<% if host_param_true?('enable-puppetlabs-pc1-repo') -%>
<% if host_param_true?('enable-puppetlabs-pc1-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
rpmkeys --import http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
rpmkeys --import http://yum.puppetlabs.com/RPM-GPG-KEY-puppet
<% end -%>
Expand Down Expand Up @@ -83,7 +85,7 @@ puppet_unit=puppet
<% if os_family == 'Freebsd' -%>
echo 'puppet_enable="YES"' >>/etc/rc.conf
<% end -%>
<% unless host_param_true?('enable-puppetlabs-pc1-repo') -%>
<% unless aio_enabled -%>
<% if os_family == 'Debian' -%>
if [ -f "/etc/default/puppet" ]
then
Expand Down
7 changes: 6 additions & 1 deletion provisioning_templates/snippet/puppetlabs_repo.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ if host_param_true?('enable-puppetlabs-repo')
repo_name = 'puppetlabs-release'
elsif host_param_true?('enable-puppetlabs-pc1-repo')
repo_name = 'puppetlabs-release-pc1'
elsif host_param_true?('enable-puppetlabs-puppet5-repo')
repo_name = 'puppet5-release'
end

repo_subdir = host_param_true?('enable-puppetlabs-puppet5-repo') ? 'puppet5/' : ''
-%>
<% if repo_name -%>
<% if os_family == 'Redhat' || os_name == 'SLES' -%>
rpm -Uvh<%= http_proxy %><%= http_port %> https://<%= repo_host %>/<%= repo_name %>-<%= repo_os %>-<%= os_major %>.noarch.rpm
rpm -Uvh<%= http_proxy %><%= http_port %> https://<%= repo_host %>/<%= repo_subdir %><%= repo_name %>-<%= repo_os %>-<%= os_major %>.noarch.rpm
<% elsif os_family == 'Debian' -%>
apt-get update
apt-get -y install ca-certificates
Expand Down

0 comments on commit 1207a19

Please sign in to comment.