Showing with 537 additions and 1,053 deletions.
  1. +1 −1 .fixtures.yml
  2. +4 −0 .gitignore
  3. +1 −1 .msync.yml
  4. +20 −0 .pmtignore
  5. +6 −13 .travis.yml
  6. +1 −0 .yardopts
  7. +17 −3 CHANGELOG.md
  8. +7 −4 Gemfile
  9. +37 −34 README.md
  10. +11 −0 Rakefile
  11. +19 −36 manifests/config.pp
  12. +28 −34 manifests/init.pp
  13. +4 −9 manifests/install.pp
  14. +0 −16 manifests/install/pe_gem.pp
  15. +15 −114 manifests/params.pp
  16. +2 −5 manifests/postrun_command.pp
  17. +2 −5 manifests/prerun_command.pp
  18. +37 −38 manifests/webhook/config.pp
  19. +14 −56 manifests/webhook/package.pp
  20. +4 −11 metadata.json
  21. +15 −0 spec/acceptance/nodesets/centos-6-x64.yml
  22. +15 −0 spec/acceptance/nodesets/centos-7-x64.yml
  23. +1 −1 spec/acceptance/nodesets/docker/centos-7.yml
  24. +31 −0 spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml
  25. +34 −0 spec/acceptance/nodesets/ec2/image_templates.yaml
  26. +29 −0 spec/acceptance/nodesets/ec2/rhel-73-x64.yml
  27. +29 −0 spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml
  28. +29 −0 spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml
  29. +29 −0 spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml
  30. +1 −1 spec/acceptance/nodesets/fedora-25-x64.yml
  31. +24 −169 spec/classes/config_spec.rb
  32. +10 −61 spec/classes/init_spec.rb
  33. +3 −7 spec/classes/install/bundle_spec.rb
  34. +1 −1 spec/classes/install/gem_spec.rb
  35. +0 −75 spec/classes/install/pe_gem_spec.rb
  36. +1 −3 spec/classes/install/puppet_gem_spec.rb
  37. +0 −92 spec/classes/install_spec.rb
  38. +2 −3 spec/classes/mcollective/application_spec.rb
  39. +40 −63 spec/classes/webhook/config_spec.rb
  40. +6 −80 spec/classes/webhook/package_spec.rb
  41. +2 −109 spec/classes/webhook_spec.rb
  42. +0 −4 spec/spec.opts
  43. +1 −1 spec/spec_helper.rb
  44. +3 −3 templates/r10k.yaml.erb
  45. +1 −0 templates/webhook.redhat.service.erb
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fixtures:
repositories:
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "4.6.0"
ref: "4.13.1"
ruby: "git://github.com/puppetlabs/puppetlabs-ruby.git"
gcc: "git://github.com/puppetlabs/puppetlabs-gcc.git"
pe_gem: "git://github.com/puppetlabs/puppetlabs-pe_gem.git"
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ spec/fixtures/manifests/
spec/fixtures/modules/
.vagrant/
.bundle/
.ruby-version
coverage/
log/
.idea/
.dependencies/
.librarian/
Puppetfile.lock
*.iml
.*.sw?
.yardoc/
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '0.16.11'
modulesync_config_version: '0.20.0'
20 changes: 20 additions & 0 deletions .pmtignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
docs/
pkg/
Gemfile.lock
Gemfile.local
vendor/
.vendor/
spec/fixtures/manifests/
spec/fixtures/modules/
.vagrant/
.bundle/
.ruby-version
coverage/
log/
.idea/
.dependencies/
.librarian/
Puppetfile.lock
*.iml
.*.sw?
.yardoc/
19 changes: 6 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
---
sudo: false
dist: trusty
language: ruby
cache: bundler
bundler_args: --without system_tests development
before_install:
- bundle -v
- rm Gemfile.lock || true
- gem update --system
- gem install bundler -v '~>1.13.0'
- gem update bundler
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
matrix:
fast_finish: true
include:
- rvm: 1.9.3
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test
- rvm: 1.9.3
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test
- rvm: 2.1.9
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test
- rvm: 2.1.9
env: PUPPET_VERSION="~> 4.0" CHECK=test
- rvm: 2.2.6
env: PUPPET_VERSION="~> 4.0" CHECK=test
- rvm: 2.3.3
env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes
- rvm: 2.3.3
env: PUPPET_VERSION="~> 4.0" CHECK=rubocop
- rvm: 2.3.3
env: PUPPET_VERSION="~> 4.0" CHECK=test
- rvm: 2.4.0
env: PUPPET_VERSION="~> 4.0" CHECK=test
allow_failures:
- rvm: 2.4.0
- rvm: 2.4.0
env: PUPPET_VERSION="~> 4.0" CHECK=rubocop
- rvm: 2.4.0
env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes
branches:
only:
- master
Expand Down
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--markup markdown
--output-dir docs/
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not impact the functionality of the module.

## [v4.2.0](https://github.com/voxpupuli/puppet-r10k/tree/v4.2.0) (2017-02-11)
## [v5.0.0](https://github.com/voxpupuli/puppet-r10k/tree/v5.0.0) (2017-03-07)
[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v4.2.0...v5.0.0)

This is the last release with Puppet3 support!
**Closed issues:**

- r10k.yaml placement is incorrect [\#342](https://github.com/voxpupuli/puppet-r10k/issues/342)

**Merged pull requests:**

- r10k.yaml contents indentation is incorrect [\#345](https://github.com/voxpupuli/puppet-r10k/pull/345) ([Kotty666](https://github.com/Kotty666))
- Update yaml location for \>PE3 [\#343](https://github.com/voxpupuli/puppet-r10k/pull/343) ([rnelson0](https://github.com/rnelson0))
- replace all validate functions with datatypes [\#341](https://github.com/voxpupuli/puppet-r10k/pull/341) ([bastelfreak](https://github.com/bastelfreak))
- Cleanup webhook use case notes; specifically PE/FOSS split. [\#338](https://github.com/voxpupuli/puppet-r10k/pull/338) ([rnelson0](https://github.com/rnelson0))
- Remove support for Puppet 3 and Ruby \<2.0.0 [\#321](https://github.com/voxpupuli/puppet-r10k/pull/321) ([rnelson0](https://github.com/rnelson0))
- Ensure webhook run folder exists on redhat systemd environments [\#283](https://github.com/voxpupuli/puppet-r10k/pull/283) ([luisfdez](https://github.com/luisfdez))

## [v4.2.0](https://github.com/voxpupuli/puppet-r10k/tree/v4.2.0) (2017-02-12)
[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v4.1.0...v4.2.0)

**Closed issues:**
Expand Down Expand Up @@ -712,4 +726,4 @@ This is the last release with Puppet3 support!
## [v0.0.1](https://github.com/voxpupuli/puppet-r10k/tree/v0.0.1) (2013-06-12)


\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
11 changes: 7 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false
gem 'puppetlabs_spec_helper', '~> 2.0.1', :require => false
gem 'parallel_tests', :require => false
gem 'rspec-puppet', '~> 2.5', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-utils', :require => false
Expand All @@ -29,10 +30,12 @@ group :test do
gem 'redcarpet', :require => false
gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
gem 'mocha', '>= 1.2.1', :require => false
gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0'
gem 'simplecov-console', :require => false if RUBY_VERSION >= '2.0.0'
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2'
end

group :development do
Expand Down
71 changes: 37 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class { 'r10k':

* Installation of the r10k `gem`
* Installation of git
* Installation of ruby when not using an existing ruby stack i.e. when using `pe_gem` or `puppet_gem`
* Installation of ruby if not using an existing ruby stack i.e. when using `pe_gem` or `puppet_gem`.
* Installation of ruby when not using an existing ruby stack i.e. when using `puppet_gem`
* Management of the `r10k.yaml` in /etc
* Installation and configuration of a sinatra app when using the [webhook](#webhook-support).

Expand All @@ -72,7 +71,7 @@ You can override this by passing the `version` parameter.

| Module Version | r10k Version |
| -------------- | ------------ |
| Next Major | [![Latest Version](https://img.shields.io/gem/v/r10k.svg?style=flat-square)](https://rubygems.org/gems/r10k) |
| v4.0.0+ | [![Latest Version](https://img.shields.io/gem/v/r10k.svg?style=flat-square)](https://rubygems.org/gems/r10k) |
| v3.0.x | 1.5.1 |
| v2.8.2 | 1.5.1 |
| v2.7.x | 1.5.1 |
Expand Down Expand Up @@ -135,16 +134,6 @@ ruby using the [puppetlabs/ruby](http://forge.puppetlabs.com/puppetlabs/ruby) mo

It also supports installation via multiple providers, such as installation in the puppet_enterprise ruby stack in versions less than 3.8

Installing into the puppet enterprise ruby stack in PE 3.x
```puppet
class { 'r10k':
remote => 'git@github.com:someuser/puppet.git',
provider => 'pe_gem',
}
```
_Note: On Puppet Enterprise 3.8 and higher the package is not declared as 3.8
ships with an embdedded r10k gem installed via the PE packages. To install r10k on a PE 3.8+ non-master, set puppet_master to false for the main r10k class (e.g. to use r10k with Razor)_

Installing into the Puppet Enterprise ruby stack in PE 2015.x

```puppet
Expand Down Expand Up @@ -249,18 +238,19 @@ class { 'r10k::mcollective':
ensure => false,
}
```
This will remove the mcollective agent/application and ddl files from disk. This likely would be if you are migrating to Code managerin Puppet Enterprise.
This will remove the mcollective agent/application and ddl files from disk. This likely would be if you are migrating to Code manager in Puppet Enterprise.

# Webhook Support

![alt tag](https://gist.githubusercontent.com/acidprime/be25026c11a76bf3e7fb/raw/44df86181c3e5d14242a1b1f4281bf24e9c48509/webhook.gif)
For version control systems that use web driven post-receive processes you can use the example webhook included in this module.
This webhook currently only runs on Puppet Enterprise and uses mcollective to automatically synchronize your environment across multiple masters.
The webhook must be configured on the respective "control" repository a master that has mco installed and can contact the other masters in your fleet.
When the webhook receives the post-receive event, it will synchronize environments on your puppet masters.
The webhook uses mcollective for multi-master synchronization and the `peadmin` user from Puppet Enterprise by default.
These settings are all configurable for your specific use case, as shown below in these configuration examples.

### Webhook Github Enterprise - Non Authenticated
This is an example of using the webhook without authentication.
The `git_webhook` type will use the [api token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) to add the webhook to the "control" repo that contains your puppetfile. This is typically useful when you want to automate the addtion of the webhook to the repo.
The `git_webhook` type will use the [api token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) to add the webhook to the "control" repo that contains your puppetfile. This is typically useful when you want to automate the addition of the webhook to the repo.

```puppet
# Required unless you disable mcollective
Expand Down Expand Up @@ -308,8 +298,8 @@ git_webhook { 'web_post_receive_webhook_for_module' :
```

### Webhook Github Example - Authenticated
This is an example of using the webhook with authentication
The `git_webhook` type will use the [api token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) to add the webhook to the "control" repo that contains your puppetfile. This is typically useful when you want to automate the addtion of the webhook to the repo.
This is an example of using the webhook with authentication.
The `git_webhook` type will use the [api token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) to add the webhook to the "control" repo that contains your puppetfile. This is typically useful when you want to automate the addition of the webhook to the repo.

```puppet
# Required unless you disable mcollective
Expand Down Expand Up @@ -377,7 +367,7 @@ class { 'r10k::webhook':
```

### Webhook - remove webhook init script and config file.
Moving to Code manager, and removing webhook
For use when moving to Code Manager, or other solutions, and the webhook should be removed.
```puppet
class {'r10k::webhook::config':
ensure => false,
Expand All @@ -389,9 +379,9 @@ class {'r10k::webhook':
```

### Running without mcollective
If you have only a single master, you may want to have the webhook run r10k directly rather then
as peadmin via mcollective. This requires you to run as the user that can perform `r10k` commands
which is typically root. The peadmin certificate no longer is managed or required.
If you have only a single master, you may want to have the webhook run r10k directly rather then as peadmin via mcollective.
This requires you to run as the user that can perform `r10k` commands which is typically root.
The peadmin certificate no longer is managed or required.


```puppet
Expand All @@ -416,11 +406,12 @@ class {'r10k::webhook':
The following is an example of declaring the webhook when r10k [prefixing](#prefixes) are enabled.

#### prefix_command.rb
This script is fed the github/gitlab payload in via stdin. This script is meant to return the prefix as its output.
This is needed as the payload does not contain the r10k prefix. The simplest way to determine the prefix is to
use the remote url in the payload and find the respective key in r10k.yaml. An example prefix command is located in
this repo [here](https://github.com/voxpupuli/puppet-r10k/blob/master/files/prefix_command.rb). Note that you may need to
modify this script depending on your remote configuration to use one of the various remote styles.
This script is fed the github/gitlab payload in via stdin.
This script is meant to return the prefix as its output.
This is needed as the payload does not contain the r10k prefix.
The simplest way to determine the prefix is to use the remote url in the payload and find the respective key in r10k.yaml.
An example prefix command is located in this repo [here](https://github.com/voxpupuli/puppet-r10k/blob/master/files/prefix_command.rb).
Note that you may need to modify this script depending on your remote configuration to use one of the various remote styles.

```puppet
file {'/usr/local/bin/prefix_command.rb':
Expand Down Expand Up @@ -457,26 +448,39 @@ git_webhook { 'web_post_receive_webhook' :
```
### Webhook FOSS support
### Webhook FOSS support with MCollective

Currently the webhook relies on existing certificates for its ssl configuration.
See this following [ticket](https://github.com/voxpupuli/puppet-r10k/issues/140) for more information.
Until then , its possible to re-use you existing FOSS mcollective certificates.
Until then, its possible to re-use you existing FOSS mcollective certificates.

Here is an working example on Ubuntu 14.04.2 LTS

```puppet
class { '::r10k::webhook::config':
protected => false,
public_key_path => '/etc/mcollective/server_public.pem', # Mandatory for FOSS
private_key_path => '/etc/mcollective/server_private.pem', # Mandatory for FOSS
notify => Service['webhook'],
}
class { '::r10k::webhook':
user => 'puppet', # Mandatory for FOSS
group => 'puppet', # Mandatory for FOSS
require => Class['::r10k::webhook::config'],
}
```

### Webhook FOSS support without MCollective
Some instances may require the user/group `root/root` (Linux) or `root/wheel` (BSD).
Verify that the specified user has the permissions to run `r10k` commands.
```puppet
class { '::r10k::webhook::config':
use_mcollective => false,
public_key_path => '/etc/mcollective/server_public.pem', # Mandatory even when use_mcollective is false
private_key_path => '/etc/mcollective/server_private.pem', # Mandatory even when use_mcollective is false
}
class { '::r10k::webhook':
user => 'root', # Mandatory for FOSS
group => 'root', # Mandatory for FOSS
}
```

Expand Down Expand Up @@ -575,7 +579,6 @@ The supported installation modes for this module
* portage
* yum
* bundle
* pe_gem
* puppet_gem
* gem
* zypper
Expand Down
11 changes: 11 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ task test: [
:metadata_lint,
:release_checks,
]

begin
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
version = (Blacksmith::Modulefile.new).version
config.future_release = "v#{version}"
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not impact the functionality of the module."
config.exclude_labels = %w{duplicate question invalid wontfix modulesync}
end
rescue LoadError
end
# vim: syntax=ruby
Loading