Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove puppet 3 support and add Puppet 5 support #165

Open
wants to merge 4 commits into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
fixtures:
forge_modules:
apache:
repo: "puppetlabs/apache"
ref: "1.4.1"
concat:
repo: "puppetlabs/concat"
ref: "1.2.2"
stdlib:
repo: "puppetlabs/stdlib"
ref: "4.6.0"
ref: "4.19.0"
apt:
repo: "puppetlabs/apt"
ref: "2.1.0"
Expand All @@ -17,10 +14,10 @@ fixtures:
ref: "1.2.0"
postgresql:
repo: "puppetlabs/postgresql"
ref: "4.6.0"
ref: "5.1.0"
puppetdb:
repo: "puppetlabs/puppetdb"
ref: "5.0.0"
ref: "6.0.1"
firewall:
repo: "puppetlabs/firewall"
ref: "1.5.0"
Expand Down
28 changes: 18 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@ language: ruby
sudo: false
bundler_args: --without development
before_install: rm Gemfile.lock || true
script: bundle exec rake test
script: bundle exec rake $CHECK
matrix:
fast_finish: true
include:
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 3.8.5" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 1.3" FUTURE_PARSER="yes"
env: PUPPET_GEM_VERSION="~> 4.7.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.5.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0"
env: PUPPET_GEM_VERSION="~> 4.8.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.7.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0"
env: PUPPET_GEM_VERSION="~> 4.9.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.8.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0"
env: PUPPET_GEM_VERSION="~> 4.10.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.9.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0"
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.10.4" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0"

env: PUPPET_GEM_VERSION="~> 4.10.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=build DEPLOY_TO_FORGE=yes
- rvm: 2.4.1
env: PUPPET_GEM_VERSION="~> 5.0.0" FACTER_GEM_VERSION="~> 2.5" HIERA_GEM_VERSION="~> 3.4.0" CHECK=test
- rvm: 2.4.1
env: PUPPET_GEM_VERSION="~> 5.1.0" FACTER_GEM_VERSION="~> 2.5" HIERA_GEM_VERSION="~> 3.4.0" CHECK=test
branches:
only:
- production
- /^\d/
notifications:
email: false
deploy:
provider: puppetforge
user: abstractit
Expand All @@ -29,5 +36,6 @@ deploy:
# all_branches is required to use tags
all_branches: true
rvm: 2.1.9
# Only publish the build marked with "DEPLOY_TO_FORGE"
condition:
- $PUPPET_GEM_VERSION = '4.10.4'
- $DEPLOY_TO_FORGE = "yes"
9 changes: 2 additions & 7 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
include ::puppet
include ::puppet::defaults

$sysconfigdir = $::puppet::defaults::sysconfigdir

if ( versioncmp($::puppetversion, '4.0.0') >= 0 ) {
$bin_dir = '/opt/puppetlabs/bin'
} else {
$bin_dir = '/usr/bin'
}
$sysconfigdir = $::puppet::defaults::sysconfigdir
$bin_dir = '/opt/puppetlabs/bin'

if $::puppet::enabled {
#we want puppet enabled
Expand Down
54 changes: 16 additions & 38 deletions manifests/defaults.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,32 @@
class puppet::defaults {
case $::osfamily {
'Debian' : {
$puppetmaster_pkg = 'puppetmaster'
$sysconfigdir = '/etc/default'
$sysconfigdir = '/etc/default'
}
'RedHat' : {
$puppetmaster_pkg = 'puppet-server'
$sysconfigdir = '/etc/sysconfig'
$sysconfigdir = '/etc/sysconfig'
}
default : {
fail("Class['puppet::defaults']: Unsupported osfamily: ${::osfamily}")
}
}

# if we are currently running puppet v4 or upgrading to it
if versioncmp($::puppetversion, '4.0.0') >= 0 or $puppet::allinone {
$server_type = 'puppetserver'
$confdir = '/etc/puppetlabs/puppet'
$codedir = '/etc/puppetlabs/code'
$basemodulepath = "${codedir}/modules:${confdir}/modules"
$hiera_backends = {
'yaml' => {
'datadir' => '/etc/puppetlabs/code/hieradata/%{environment}'
}
$server_type = 'puppetserver'
$confdir = '/etc/puppetlabs/puppet'
$codedir = '/etc/puppetlabs/code'
$basemodulepath = "${codedir}/modules:${confdir}/modules"
$hiera_backends = {
'yaml' => {
'datadir' => '/etc/puppetlabs/code/hieradata/%{environment}'
}
$facterbasepath = '/opt/puppetlabs/facter'
$reports_dir = '/opt/puppetlabs/server/data/reports'
$terminus_package = 'puppetdb-termini'
$puppetdb_etcdir = '/etc/puppetlabs/puppetdb'
$puppetdb_test_url = '/pdb/meta/v1/version'
$gem_provider = 'puppetserver_gem'
$puppet_group = 'root'
} else {
$server_type = 'passenger'
$confdir = '/etc/puppet'
$codedir = '/etc/puppet'
$basemodulepath = "${confdir}/modules:/usr/share/puppet/modules"
$hiera_backends = {
'yaml' => {
'datadir' => '/etc/puppet/hieradata/%{environment}'
}
}
$facterbasepath = '/etc/facter'
$reports_dir = '/var/lib/puppet/reports'
$terminus_package = 'puppetdb-terminus'
$puppetdb_etcdir = '/etc/puppetdb'
$puppetdb_test_url = '/v3/version'
$gem_provider = 'gem'
$puppet_group = 'puppet'
}
$facterbasepath = '/opt/puppetlabs/facter'
$reports_dir = '/opt/puppetlabs/server/data/reports'
$terminus_package = 'puppetdb-termini'
$puppetdb_etcdir = '/etc/puppetlabs/puppetdb'
$puppetdb_test_url = '/pdb/meta/v1/version'
$gem_provider = 'puppetserver_gem'
$puppet_group = 'root'
$puppetdb_confdir = "${puppetdb_etcdir}/conf.d"
$puppetdb_ssl_dir = "${puppetdb_etcdir}/ssl"
$autosign_file = "${confdir}/autosign.conf"
Expand Down
8 changes: 4 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @puppet when declaring the puppet class
# include puppet
#
# @param allinone [Boolean] Default: false
# @param allinone [Boolean] Default: true
# Whether to use the new collections
# @param agent_cron_hour [String] Default: '*'
# The hour to run the agent cron. Valid values are `0-23`
Expand All @@ -23,7 +23,7 @@
# Port to use as the CA server for all agents.
# @param cfacter [Boolean] Default: false
# Whether or not to use cfacter instead of facter.
# @param collection [String] Default: undef
# @param collection [String] Default: PC1
# Declares the collection repository to use.
# @param custom_facts [Hash] Default: undef
# A hash of custom facts to setup using the ::puppet::facts define.
Expand Down Expand Up @@ -100,14 +100,14 @@
# https://tickets.puppetlabs.com/browse/PUP-1035)

class puppet (
$allinone = false,
$allinone = true,
$agent_cron_hour = '*',
$agent_cron_min = 'two_times_an_hour',
$agent_version = 'installed',
$ca_server = undef,
$ca_port = undef,
$cfacter = false,
$collection = undef,
$collection = 'PC1',
$custom_facts = undef,
$devel_repo = false,
$enabled = true,
Expand Down
21 changes: 4 additions & 17 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@
include ::puppet
include ::puppet::defaults

$allinone = $::puppet::allinone
$agent_version = $::puppet::agent_version
$puppet_version = $::puppet::puppet_version
$agent_version = $::puppet::agent_version

if ($allinone) {
$agent_package = 'puppet-agent'
$package_ensure = $agent_version
} else {
$agent_package = 'puppet'
$package_ensure = $puppet_version
}

include ::puppet::install::deps

package { $agent_package:
ensure => $package_ensure,
require => Class['::puppet::install::deps'],
notify => Class['::puppet::agent'],
package { 'puppet-agent':
ensure => $agent_version,
notify => Class['::puppet::agent'],
}

}
36 changes: 0 additions & 36 deletions manifests/install/deps.pp

This file was deleted.

14 changes: 1 addition & 13 deletions manifests/master.pp
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,7 @@
include ::puppet::master::install
include ::puppet::master::config
include ::puppet::master::hiera

case $server_type {
'puppetserver': {
include ::puppet::master::server
# Class['puppet::master::hiera'] ~>
# Class['puppet::master::server']
}
default: {
include ::puppet::master::passenger
# Class['puppet::master::hiera'] ~>
# Class['puppet::master::passenger']
}
}
include ::puppet::master::server

Class['puppet::master::install'] ->
Class['puppet::master::config'] ->
Expand Down
24 changes: 2 additions & 22 deletions manifests/master/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,16 @@
include ::puppet::defaults
include ::puppet::master

$allinone = $::puppet::allinone
$server_type = $::puppet::master::server_type
$hiera_eyaml_version = $::puppet::master::hiera_eyaml_version
$manage_hiera_eyaml_package = $::puppet::master::manage_hiera_eyaml_package
$deep_merge_version = $::puppet::master::deep_merge_version
$manage_deep_merge_package = $::puppet::master::manage_deep_merge_package
$puppet_version = $::puppet::master::puppet_version
$puppetmaster_pkg = $::puppet::defaults::puppetmaster_pkg
$server_version = $::puppet::master::server_version
$gem_provider = $::puppet::defaults::gem_provider

if ($allinone == true) {
$server_package = 'puppetserver'
$package_ensure = $server_version
} else {
if ($server_type == 'puppetserver') {
$server_package = 'puppetserver'
$package_ensure = $server_version
} else {
$server_package = $puppetmaster_pkg
$package_ensure = $puppet_version
}
}

include ::puppet::master::install::deps

package { $server_package:
ensure => $package_ensure,
package { 'puppetserver':
ensure => $server_version,
require => [
Class[puppet::master::install::deps],
Class[puppet::install],
],
}
Expand Down
21 changes: 0 additions & 21 deletions manifests/master/install/deps.pp

This file was deleted.

Loading