Skip to content

Commit

Permalink
Remove dynamic and config environments
Browse files Browse the repository at this point in the history
Since Puppet 4 only directory environments are supported so this was
mostly dead code.
  • Loading branch information
ekohl authored and mmoll committed Dec 16, 2018
1 parent aa54b96 commit a61e010
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 577 deletions.
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ any options that are not explicitly supported.

## Environments support

The module helps configure Puppet environments using directory environments on
Puppet 3.6+ and config environments on older versions. These are set up under
/etc/puppet/environments/ - change `server_environments` to define the list to
create, or use `puppet::server::env` for more control. When using directory
environments with R10K you need to set the `server_environments` parameter to an
empty array ie. `[]` to prevent `r10k deploy environments` from reporting an
error caused by the creation of top level environment directory(s).
The module helps configure Puppet environments using directory environments.
These are set up under /etc/puppetlabs/code/environments.

## Git repo support

Expand Down Expand Up @@ -99,15 +94,6 @@ wrapper classes or even your ENC (if it supports param classes). For example:
server_external_nodes => '',
}

# The same example as above but overriding `server_environments` for R10K
class { '::puppet':
server => true,
server_foreman => false,
server_reports => 'store',
server_external_nodes => '',
server_environments => [],
}

# Want to integrate with an existing PuppetDB?
class { '::puppet':
server => true,
Expand Down
18 changes: 1 addition & 17 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -231,26 +231,13 @@
#
# $server_git_repo:: Use git repository as a source of modules
#
# $server_dynamic_environments:: Use $environment in the modulepath
# Deprecated when $server_directory_environments is true,
# set $server_environments to [] instead.
#
# $server_directory_environments:: Enable directory environments, defaulting to true
# with Puppet 3.6.0 or higher
#
# $server_environments:: Environments to setup (creates directories).
# Applies only when $server_dynamic_environments
# is false
#
# $server_environments_owner:: The owner of the environments directory
#
# $server_environments_group:: The group owning the environments directory
#
# $server_environments_mode:: Environments directory mode.
#
# $server_common_modules_path:: Common modules paths (only when
# $server_git_repo_path and $server_dynamic_environments
# are false)
# $server_common_modules_path:: Common modules paths
#
# $server_git_repo_path:: Git repository path
#
Expand Down Expand Up @@ -637,12 +624,9 @@
Optional[String] $server_config_version = $puppet::params::server_config_version,
Integer[0] $server_connect_timeout = $puppet::params::server_connect_timeout,
Boolean $server_git_repo = $puppet::params::server_git_repo,
Boolean $server_dynamic_environments = $puppet::params::server_dynamic_environments,
Boolean $server_directory_environments = $puppet::params::server_directory_environments,
Boolean $server_default_manifest = $puppet::params::server_default_manifest,
Stdlib::Absolutepath $server_default_manifest_path = $puppet::params::server_default_manifest_path,
String $server_default_manifest_content = $puppet::params::server_default_manifest_content,
Array[String] $server_environments = $puppet::params::server_environments,
String $server_environments_owner = $puppet::params::server_environments_owner,
Optional[String] $server_environments_group = $puppet::params::server_environments_group,
Pattern[/^[0-9]{3,4}$/] $server_environments_mode = $puppet::params::server_environments_mode,
Expand Down
7 changes: 0 additions & 7 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,6 @@
# Git branch to puppet env mapping for the post receive hook
$server_git_branch_map = {}

# Static environments config, ignore if the git_repo or dynamic_environments is 'true'
# What environments do we have
$server_environments = ['development', 'production']
# Dynamic environments config (deprecated when directory_environments is true)
$server_dynamic_environments = false
# Directory environments config
$server_directory_environments = true
# Owner of the environments dir: for cases external service needs write
# access to manage it.
$server_environments_owner = $user
Expand Down
18 changes: 1 addition & 17 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,6 @@
#
# $git_repo:: Use git repository as a source of modules
#
# $dynamic_environments:: Use $environment in the modulepath
# Deprecated when $directory_environments is true,
# set $environments to [] instead.
#
# $directory_environments:: Enable directory environments, defaulting to true
# with Puppet 3.6.0 or higher
#
# $environments:: Environments to setup (creates directories).
# Applies only when $dynamic_environments
# is false
#
# $environments_owner:: The owner of the environments directory
#
# $environments_group:: The group owning the environments directory
Expand All @@ -84,9 +73,7 @@
# $envs_target:: Indicates that $envs_dir should be
# a symbolic link to this target
#
# $common_modules_path:: Common modules paths (only when
# $git_repo_path and $dynamic_environments
# are false)
# $common_modules_path:: Common modules paths
#
# $git_repo_path:: Git repository path
#
Expand Down Expand Up @@ -334,12 +321,9 @@
Integer[0] $connect_timeout = $::puppet::server_connect_timeout,
Integer[0] $web_idle_timeout = $puppet::server_web_idle_timeout,
Boolean $git_repo = $::puppet::server_git_repo,
Boolean $dynamic_environments = $::puppet::server_dynamic_environments,
Boolean $directory_environments = $::puppet::server_directory_environments,
Boolean $default_manifest = $::puppet::server_default_manifest,
Stdlib::Absolutepath $default_manifest_path = $::puppet::server_default_manifest_path,
String $default_manifest_content = $::puppet::server_default_manifest_content,
Array[String] $environments = $::puppet::server_environments,
String $environments_owner = $::puppet::server_environments_owner,
Optional[String] $environments_group = $::puppet::server_environments_group,
Pattern[/^[0-9]{3,4}$/] $environments_mode = $::puppet::server_environments_mode,
Expand Down
40 changes: 10 additions & 30 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,13 @@

puppet::config::main {
'reports': value => $::puppet::server::reports;
'environmentpath': value => $puppet::server::envs_dir;
}
if $::puppet::server::hiera_config and !empty($::puppet::server::hiera_config){
puppet::config::main {
'hiera_config': value => $::puppet::server::hiera_config;
}
}
if $puppet::server::directory_environments {
puppet::config::main {
'environmentpath': value => $puppet::server::envs_dir;
}
}
if $puppet::server::common_modules_path and !empty($puppet::server::common_modules_path) {
puppet::config::main {
'basemodulepath': value => $puppet::server::common_modules_path, joiner => ':';
Expand Down Expand Up @@ -95,17 +91,6 @@
'storeconfigs_backend': value => $server_storeconfigs_backend;
}
}
if !$::puppet::server::directory_environments and ($::puppet::server::git_repo or $::puppet::server::dynamic_environments) {
puppet::config::master {
'manifest': value => "${::puppet::server::envs_dir}/\$environment/manifests/site.pp";
'modulepath': value => "${::puppet::server::envs_dir}/\$environment/modules";
}
if $::puppet::server::config_version_cmd {
puppet::config::master {
'config_version': value => $::puppet::server::config_version_cmd;
}
}
}

$::puppet::server_additional_settings.each |$key,$value| {
puppet::config::master { $key: value => $value }
Expand Down Expand Up @@ -269,24 +254,19 @@
mode => $::puppet::server::git_repo_mode,
require => Git::Repo['puppet_repo'],
}
}

file { $puppet::sharedir:
ensure => directory,
}
elsif ! $::puppet::server::dynamic_environments {
file { $puppet::sharedir:
ensure => directory,
}

if $::puppet::server::common_modules_path and $::puppet::server::common_modules_path != '' {
file { $::puppet::server::common_modules_path:
ensure => directory,
owner => $::puppet::server_environments_owner,
group => $::puppet::server_environments_group,
mode => $::puppet::server_environments_mode,
}
if $::puppet::server::common_modules_path and !empty($::puppet::server::common_modules_path) {
file { $::puppet::server::common_modules_path:
ensure => directory,
owner => $::puppet::server_environments_owner,
group => $::puppet::server_environments_group,
mode => $::puppet::server_environments_mode,
}

# setup empty directories for our environments
puppet::server::env {$::puppet::server::environments: }
}

## Foreman
Expand Down
94 changes: 0 additions & 94 deletions manifests/server/env.pp

This file was deleted.

Loading

0 comments on commit a61e010

Please sign in to comment.