Showing with 991 additions and 652 deletions.
  1. +6 −2 .rubocop.yml
  2. +4 −0 .sync.yml
  3. +1 −10 .travis.yml
  4. +6 −0 .vscode/extensions.json
  5. +8 −0 CODEOWNERS
  6. +11 −10 Gemfile
  7. +13 −2 Rakefile
  8. +1 −0 appveyor.yml
  9. +13 −17 documentation/basic_usage.md
  10. BIN documentation/images/PE_Large_Architecture_no_HA.png
  11. BIN documentation/images/architecture.png
  12. BIN documentation/images/pe-compiler-group-a.png
  13. BIN documentation/images/pe-compiler-group-b.png
  14. BIN documentation/images/pe-master-a.png
  15. BIN documentation/images/pe-master-b.png
  16. +60 −0 documentation/install_and_configure_without_ha.md
  17. +67 −0 documentation/large_deploy.md
  18. +22 −0 functions/fail_on_transport.pp
  19. +44 −0 functions/generate_pe_conf.pp
  20. +19 −0 functions/get_targets.pp
  21. +15 −0 functions/target_host.pp
  22. +80 −0 functions/validate_architecture.pp
  23. +0 −11 lib/puppet/functions/pe_xl/to_json.rb
  24. +0 −25 manifests/setup/master.pp
  25. +4 −3 manifests/setup/node_manager.pp
  26. +13 −13 metadata.json
  27. +0 −100 plans/configure.pp
  28. +0 −90 plans/init.pp
  29. +0 −241 plans/install.pp
  30. +83 −0 plans/provision.pp
  31. +117 −0 plans/unit/configure.pp
  32. +310 −0 plans/unit/install.pp
  33. +42 −20 plans/upgrade.pp
  34. +7 −0 spec/spec_helper.rb
  35. +2 −6 tasks/code_manager.json
  36. +1 −1 tasks/code_manager.sh
  37. +4 −4 tasks/configure_node_groups.json
  38. +28 −16 tasks/configure_node_groups.sh
  39. +1 −1 tasks/hostname.sh
  40. +0 −56 templates/master-pe.conf.epp
  41. +0 −24 templates/puppetdb_database-pe.conf.epp
  42. +1 −0 types/pem.pp
  43. +8 −0 types/singletargetspec.pp
8 changes: 6 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
require: rubocop-rspec
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Expand All @@ -19,10 +21,12 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/*
- spec/**/*
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Expand Down
4 changes: 4 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
Rakefile:
extras:
- 'PuppetSyntax.exclude_paths = ["plans/**/*.pp", "vendor/**/*"]'
11 changes: 1 addition & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
dist: trusty
dist: xenial
language: ruby
cache: bundler
before_install:
Expand Down Expand Up @@ -43,12 +43,3 @@ branches:
- /^v\d/
notifications:
email: false
deploy:
provider: puppetforge
user: puppet
password:
secure: ""
on:
tags: true
all_branches: true
condition: "$DEPLOY_TO_FORGE = yes"
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"jpogran.puppet-vscode",
"rebornix.Ruby"
]
}
8 changes: 8 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @puppetlabs/solutions-architecture
21 changes: 11 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
15 changes: 13 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
Expand All @@ -14,8 +15,17 @@ end

def changelog_project
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = nil || JSON.load(File.read('metadata.json'))['name']
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?

returnVal = nil
returnVal ||= begin
metadata_source = JSON.load(File.read('metadata.json'))['source']
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})

metadata_source_match && metadata_source_match[1]
end

raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?

puts "GitHubChangelogGenerator project:#{returnVal}"
returnVal
end
Expand Down Expand Up @@ -74,3 +84,4 @@ EOM
end
end

PuppetSyntax.exclude_paths = ["plans/**/*.pp", "vendor/**/*"]
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: 1.1.x.{build}
branches:
only:
- master
- release
skip_commits:
message: /^\(?doc\)?.*/
clone_depth: 10
Expand Down
30 changes: 13 additions & 17 deletions documentation/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@

This is a base reference implementation. Once a base stack is stood up, you may need to continue and perform additional configuration and adjustments to reach your target state, depending on your use case.

The reference implementation currently includes Task Plans to install, configure, and later upgrade a new Extra Large HA stack.
The reference implementation currently includes Task Plans to provision new stacks, and to upgrade stacks previously provisioned using this module.

The current versions of those plans can be found at:

* [install.pp](https://github.com/reidmv/reidmv-pe_xl/blob/master/plans/install.pp)
* [configure.pp](https://github.com/reidmv/reidmv-pe_xl/blob/master/plans/configure.pp)
* [upgrade.pp](https://github.com/reidmv/reidmv-pe_xl/blob/master/plans/upgrade.pp)
* [provision.pp](../plans/provision.pp)
* [upgrade.pp](../plans/upgrade.pp)

These are still a work in progress and lack documentation. Reading through them can give you an idea of what steps we've found to be required to deploy and configure all of the Puppet Enterprise components.
Provisioning can be broken down into two actions: [install](../plans/unit/install.pp), and [configure](../plans/unit/configure.pp). Installation currently requires ssh access to the un-provisioned nodes, but configure can be performed using the Orchestrator transport if installation has already been completed.

Besides getting everything installed the key configuration that makes this work is laid out in four classification groups. Links provided below to a Markdown document that describes the groups, and also to the Puppet manifest that actually configures them:
Besides getting Puppet Enterprise installed, the key configuration supporting Large and Extra Large architectures is laid out in four classification groups. Links are provided below to a Markdown document that describes the groups, and also to the Puppet manifest that actually configures them:

* [classification.md](https://github.com/reidmv/reidmv-pe_xl/blob/master/docs/classification.md)
* [pe\_xl::node\_manager class](https://github.com/reidmv/reidmv-pe_xl/blob/master/manifests/node_manager.pp)
* [classification.md](classification.md)
* [pe\_xl::node\_manager class](../manifests/node_manager.pp)

The reference implementation uses trusted facts to put nodes in the right groups. Because the important puppet\_enterprise::\* class parameters and data are specified in the console, it should also be safe to have a pe.conf present on both the master, and the master replica nodes.

## Basic usage instructions

1. Ensure the hostname of each system is set correctly, to the same value that will be used to connect to the system, and refer to the system as. If the hostname is not set as expected the installation plan will refuse to continue.
2. Install Bolt on a jumphost. This can be the master, or any other system.
3. Download or git clone the pe\_xl module and put it somewhere on the jumphost, e.g. ~/modules/pe\_xl.
1. Install Bolt on a jumphost. This can be the master, or any other system.
2. Download or git clone the pe\_xl module and put it somewhere on the jumphost. e.g. ~/modules/pe\_xl.
2. Download or git clone the module dependencies, and put them somewhere on the jumphost. e.g. ~/modules/stdlib, ~/modules/node\_manager, etc.
2. Ensure the hostname of each system is set correctly, to the same value that will be used to connect to the system, and refer to the system as. If the hostname is not set as expected the installation plan will refuse to continue.
4. Create an inventory file with connection information. Example included below. Available Bolt configuration options are documented here.
5. Create a parameters file. Example included below. Note at the top of the file are arguments which dictate which plans should be run, such as install+configure.
6. Run the pe\_xl plan with the inputs created. Example:

bolt plan run pe_xl \
bolt plan run pe_xl::provision \
--inventory nodes.yaml \
--modulepath ~/modules \
--params @params.json
Expand Down Expand Up @@ -59,10 +59,6 @@ Example params.json Bolt parameters file:
```json
{
"install": true,
"configure": true,
"upgrade": false,

"master_host": "pe-xl-core-0.lab1.puppet.vm",
"puppetdb_database_host": "pe-xl-core-1.lab1.puppet.vm",
"master_replica_host": "pe-xl-core-2.lab1.puppet.vm",
Expand All @@ -75,6 +71,6 @@ Example params.json Bolt parameters file:
"console_password": "puppetlabs",
"dns_alt_names": [ "puppet", "puppet.lab1.puppet.vm" ],
"compiler_pool_address": "puppet.lab1.puppet.vm",
"version": "2018.1.4"
"version": "2019.1.1"
}
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/pe-compiler-group-a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/pe-compiler-group-b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/pe-master-a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/pe-master-b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions documentation/install_and_configure_without_ha.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Install and configure Extra Large without HA

* TODO: add this doc as a section to basic_usage.md instead?

Please see the [basic_usage.md](basic_usage.md) document for reference; this document will avoid repeating the information covered there.
The install, configure, and upgrade plans covered in the [basic_usage.md](basic_usage.md) document can also set up the Extra Large environment without HA by omitting the optional settings `master_replica_host` and `puppetdb_database_replica_host` in the params.json file (see the [example](#example-params.json-bolt-parameters-file) below).

## Basic usage instructions

1. Ensure the hostname of each system is set correctly, to the same value that will be used to connect to the system, and refer to the system as. If the hostname is not set as expected the installation plan will refuse to continue.
2. Install Bolt on a jumphost. This can be the master, or any other system.
3. Download or git clone the pe\_xl module and put it somewhere on the jumphost, e.g. ~/modules/pe\_xl.
4. Create an inventory file with connection information. An example is included below.
5. Create a parameters file. An example is included below. Note the omission of the `master_replica_host` and `puppetdb_database_replica_host` parameters.
6. Run the pe\_xl plan with the inputs created. Example:
```
bolt plan run pe_xl::provision \
--inventory nodes.yaml \
--modulepath ~/modules \
--params @params.json
```

### Example nodes.yaml Bolt inventory file

```yaml

---
groups:
- name: pe_xl_nodes
config:
transport: ssh
ssh:
host-key-check: false
user: centos
run-as: root
tty: true
nodes:
- pe-xl-core-0.lab1.puppet.vm
- pe-xl-core-1.lab1.puppet.vm
- pe-xl-compiler-0.lab1.puppet.vm
- pe-xl-compiler-1.lab1.puppet.vm
```
### Example params.json Bolt parameters file
```json
{
"master_host": "pe-xl-core-0.lab1.puppet.vm",
"puppetdb_database_host": "pe-xl-core-1.lab1.puppet.vm",
"compiler_hosts": [
"pe-xl-compiler-0.lab1.puppet.vm",
"pe-xl-compiler-1.lab1.puppet.vm"
],

"console_password": "puppetlabs",
"dns_alt_names": [ "puppet", "puppet.lab1.puppet.vm" ],
"compiler_pool_address": "puppet.lab1.puppet.vm",
"version": "2019.1.1"
}
```
67 changes: 67 additions & 0 deletions documentation/large_deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# PE Large Architecture


## Overview

This module can also be used to deploy a Puppet Enterprise Large Architecture.
Such an deployment differs from an Extra Large Architecture in that it does
**not** include an external database. PuppetDB is served from the master.

**NOTE:** Currently, the module does not deploy a Large Architecture with HA.
The currently supported deployment architecture is shown below.

![Large Architecture without HA](images/PE_Large_Architecture_no_HA.png)


## Instructions

The process for deploying a PE Large Architecture is very similar to the
[basic_usage](basic_usage.md) for deploying the XL Architecture. These two
differ only in the parameters supplied to the bolt plans. Specifically, the
`puppetdb_database_host`, `master_replica_host`, and
`puppetdb_database_replica_host` parameters need to be omitted in order to
deploy a PE Large Architecture.

Ensuring that the parameters above are omitted from the `params.json` file,
the [basic usage instructions](basic_usage.md#basic-usage-instructions) can be
used to run the `pe_xl` plan in order to install and configure the deployment.

Example nodes.yaml Bolt inventory file:

```yaml
---
groups:
- name: pe_xl_nodes
config:
transport: ssh
ssh:
host-key-check: false
user: centos
run-as: root
tty: true
nodes:
- pe-xl-core-0.lab1.puppet.vm
- pe-xl-compiler-0.lab1.puppet.vm
- pe-xl-compiler-1.lab1.puppet.vm
```
Example params.json Bolt parameters file:
```json
{
"install": true,
"configure": true,
"upgrade": false,

"master_host": "pe-xl-core-0.lab1.puppet.vm",
"compiler_hosts": [
"pe-xl-compiler-0.lab1.puppet.vm",
"pe-xl-compiler-1.lab1.puppet.vm"
],

"console_password": "puppetlabs",
"dns_alt_names": [ "puppet", "puppet.lab1.puppet.vm" ],
"compiler_pool_address": "puppet.lab1.puppet.vm",
"version": "2018.1.4"
}
```
22 changes: 22 additions & 0 deletions functions/fail_on_transport.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Fails if any nodes have the chosen transport.
#
# Useful for excluding PCP when it's not appopriate
#
function pe_xl::fail_on_transport (
TargetSpec $nodes,
String $transport,
) {
$targets = get_targets($nodes)
$targets.each |$target| {
if $target.protocol == $transport {
fail_plan(
"${target.name} uses ${transport} transport. This is not supported",
'unexpected-transport',
{
'target' => $target,
'transport' => $transport,
}
)
}
}
}
44 changes: 44 additions & 0 deletions functions/generate_pe_conf.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generates a pe.conf file, removing undef parameters
#
# @param user_settings
# A hash of settings to set in the config file. Any keys that are set to
# undef will not be included in the config file. This is done to reduce the
# amount of logic required within plans if parameters are not passed in.
#
function pe_xl::generate_pe_conf (
Hash $settings,
) {
# Check that console_admin_password is present
unless $settings['console_admin_password'] =~ String {
fail('pe.conf must have the console_admin_password set')
}

# Define the configuration settings that will be placed in pe.conf by
# default. These can be overriden by user-supplied values in the $settings
# hash.
$defaults = {
'puppet_enterprise::profile::master::java_args' => {
'Xmx' => '2048m',
'Xms' => '512m',
},
'puppet_enterprise::profile::console::java_args' => {
'Xmx' => '768m',
'Xms' => '256m',
},
'puppet_enterprise::profile::orchestrator::java_args' => {
'Xmx' => '768m',
'Xms' => '256m',
},
'puppet_enterprise::profile::puppetdb::java_args' => {
'Xmx' => '768m',
'Xms' => '256m',
},
}

# Merge the defaults with user-supplied settings, remove anything that is
# undef, then output to JSON (and therefore HOCON, because HOCON is a
# superset of JSON)
($defaults + $settings).filter |$key,$value| {
$value != undef
}.to_json_pretty()
}
Loading