Skip to content

Commit 759ccb8

Browse files
committed
Stop managing environment node groups
In PE 2019.0.2 and PE 2018.1.7, correct, sane environment node group configuration ships out of the box. Therefore there is no need for this module to set up something sane for the user.
1 parent adfeaf2 commit 759ccb8

File tree

5 files changed

+22
-133
lines changed

5 files changed

+22
-133
lines changed

manifests/setup/node_manager.pp

+6-55
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
# }'
1313
#
1414
class pe_xl::setup::node_manager (
15-
String[1] $master_host,
16-
String[1] $master_replica_host,
17-
String[1] $puppetdb_database_host,
18-
String[1] $puppetdb_database_replica_host,
19-
String[1] $compiler_pool_address,
20-
Boolean $manage_environment_groups = true,
21-
Pattern[/\A[a-z0-9_]+\Z/] $default_environment = 'production',
22-
Array[Pattern[/\A[a-z0-9_]+\Z/]] $environments = ['production'],
15+
String[1] $master_host,
16+
String[1] $puppetdb_database_host,
17+
String[1] $compiler_pool_address,
18+
19+
Optional[String[1]] $master_replica_host = undef,
20+
Optional[String[1]] $puppetdb_database_replica_host = undef,
2321
) {
2422

2523
##################################################
@@ -163,51 +161,4 @@
163161
},
164162
}
165163

166-
167-
if ($manage_environment_groups) {
168-
169-
##################################################
170-
# ENVIRONMENT GROUPS
171-
##################################################
172-
173-
node_group { 'All Environments':
174-
ensure => present,
175-
description => 'Environment group parent and default',
176-
environment => $default_environment,
177-
override_environment => true,
178-
parent => 'All Nodes',
179-
rule => ['and', ['~', 'name', '.*']],
180-
}
181-
182-
node_group { 'Agent-specified environment':
183-
ensure => present,
184-
description => 'This environment group exists for unusual testing and development only. Expect it to be empty',
185-
environment => 'agent-specified',
186-
override_environment => true,
187-
parent => 'All Environments',
188-
rule => [ ],
189-
}
190-
191-
$environments.each |$env| {
192-
$title_env = capitalize($env)
193-
194-
node_group { "${title_env} environment":
195-
ensure => present,
196-
environment => $env,
197-
override_environment => true,
198-
parent => 'All Environments',
199-
rule => ['and', ['=', ['trusted', 'extensions', 'pp_environment'], $env]],
200-
}
201-
202-
node_group { "${title_env} one-time run exception":
203-
ensure => present,
204-
description => "Allow ${env} nodes to request a different puppet environment for a one-time run",
205-
environment => 'agent-specified',
206-
override_environment => true,
207-
parent => "${title_env} environment",
208-
rule => ['and', ['~', ['fact', 'agent_specified_environment'], '.+']],
209-
}
210-
}
211-
212-
}
213164
}

plans/configure.pp

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
Boolean $executing_on_master = false,
1616

1717
String[1] $compiler_pool_address = $master_host,
18-
Boolean $manage_environment_groups = true,
1918
Optional[String[1]] $token_file = undef,
2019
Optional[String[1]] $deploy_environment = undef,
2120

@@ -49,7 +48,6 @@
4948
puppetdb_database_host => $puppetdb_database_host,
5049
puppetdb_database_replica_host => $puppetdb_database_replica_host,
5150
compiler_pool_address => $compiler_pool_address,
52-
manage_environment_groups => $manage_environment_groups,
5351
)
5452

5553
# Run Puppet in no-op on the compilers so that their status in PuppetDB

plans/init.pp

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
Optional[Hash] $r10k_sources = undef,
2121
Optional[Array[String[1]]] $dns_alt_names = undef,
2222
Optional[Boolean] $executing_on_master = undef,
23-
Optional[Boolean] $manage_environment_groups = undef,
2423

2524
Optional[String[1]] $compiler_pool_address = undef,
2625
Optional[String[1]] $deploy_environment = undef,
@@ -55,7 +54,6 @@
5554

5655
executing_on_master => $executing_on_master,
5756
compiler_pool_address => $compiler_pool_address,
58-
manage_environment_groups => $manage_environment_groups,
5957
deploy_environment => $deploy_environment,
6058

6159
stagingdir => $stagingdir,

tasks/configure_node_groups.json

+10-14
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,24 @@
22
"description": "Configure console node groups for a new install",
33
"parameters": {
44
"master_host": {
5-
"type": "String",
5+
"type": "String[1]",
66
"description": "The certname of the master"
77
},
8-
"master_replica_host": {
9-
"type": "String",
10-
"description": "The certname of the master replica"
11-
},
128
"puppetdb_database_host": {
13-
"type": "String",
9+
"type": "String[1]",
1410
"description": "The certname of the PuppetDB database"
1511
},
16-
"puppetdb_database_replica_host": {
17-
"type": "String",
18-
"description": "The certname of the PuppetDB database replica"
19-
},
2012
"compiler_pool_address": {
21-
"type": "String",
13+
"type": "String[1]",
2214
"description": "The service name to use for the compiler pool"
2315
},
24-
"manage_environment_groups": {
25-
"type": "Boolean",
26-
"description": "This will regroup the production and additional PE Environment groups"
16+
"master_replica_host": {
17+
"type": "Optional[String[1]]",
18+
"description": "The certname of the master replica"
19+
},
20+
"puppetdb_database_replica_host": {
21+
"type": "Optional[String[1]]",
22+
"description": "The certname of the PuppetDB database replica"
2723
}
2824
},
2925
"input_method": "environment",

tasks/configure_node_groups.sh

+6-60
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66
function param($name) { inline_template("<%= ENV['PT_${name}'] %>") }
77
88
class configure_node_groups (
9-
String[1] $master_host = param('master_host'),
10-
String[1] $master_replica_host = param('master_replica_host'),
11-
String[1] $puppetdb_database_host = param('puppetdb_database_host'),
12-
String[1] $puppetdb_database_replica_host = param('puppetdb_database_replica_host'),
13-
String[1] $compiler_pool_address = param('compiler_pool_address'),
14-
15-
# Note: the task accepts a Boolean for manage_environment_groups. Passed in
16-
# as an environment variable, this will be cast to the string "true" or the
17-
# string "false". Thus, the Puppet class type is Enum, rather than Boolean.
18-
Enum['true', 'false'] $manage_environment_groups = param('manage_environment_groups'),
19-
20-
Pattern[/\A[a-z0-9_]+\Z/] $default_environment = 'production',
21-
Array[Pattern[/\A[a-z0-9_]+\Z/]] $environments = ['production'],
9+
String[1] $master_host = param('master_host'),
10+
String[1] $puppetdb_database_host = param('puppetdb_database_host'),
11+
String[1] $compiler_pool_address = param('compiler_pool_address'),
12+
13+
Optional[String[1]] $master_replica_host = param('master_replica_host'),
14+
Optional[String[1]] $puppetdb_database_replica_host = param('puppetdb_database_replica_host'),
2215
) {
2316
2417
##################################################
@@ -162,53 +155,6 @@ class configure_node_groups (
162155
},
163156
}
164157
165-
166-
if ($manage_environment_groups == 'true') {
167-
168-
##################################################
169-
# ENVIRONMENT GROUPS
170-
##################################################
171-
172-
node_group { 'All Environments':
173-
ensure => present,
174-
description => 'Environment group parent and default',
175-
environment => $default_environment,
176-
override_environment => true,
177-
parent => 'All Nodes',
178-
rule => ['and', ['~', 'name', '.*']],
179-
}
180-
181-
node_group { 'Agent-specified environment':
182-
ensure => present,
183-
description => 'This environment group exists for unusual testing and development only. Expect it to be empty',
184-
environment => 'agent-specified',
185-
override_environment => true,
186-
parent => 'All Environments',
187-
rule => [ ],
188-
}
189-
190-
$environments.each |$env| {
191-
$title_env = capitalize($env)
192-
193-
node_group { "${title_env} environment":
194-
ensure => present,
195-
environment => $env,
196-
override_environment => true,
197-
parent => 'All Environments',
198-
rule => ['and', ['=', ['trusted', 'extensions', 'pp_environment'], $env]],
199-
}
200-
201-
node_group { "${title_env} one-time run exception":
202-
ensure => present,
203-
description => "Allow ${env} nodes to request a different puppet environment for a one-time run",
204-
environment => 'agent-specified',
205-
override_environment => true,
206-
parent => "${title_env} environment",
207-
rule => ['and', ['~', ['fact', 'agent_specified_environment'], '.+']],
208-
}
209-
}
210-
211-
}
212158
}
213159
214160
include configure_node_groups

0 commit comments

Comments
 (0)