Showing with 2,915 additions and 388 deletions.
  1. +15 −8 CHANGELOG.md
  2. +59 −30 README.md
  3. +382 −43 REFERENCE.md
  4. +0 −9 appveyor.yml
  5. +197 −0 lib/puppet/provider/sensu_agent_entity_config/sensu_api.rb
  6. +161 −0 lib/puppet/provider/sensu_agent_entity_config/sensuctl.rb
  7. +58 −0 lib/puppet/provider/sensu_agent_entity_validator/sensu_api.rb
  8. +53 −0 lib/puppet/provider/sensu_agent_entity_validator/sensuctl.rb
  9. +20 −6 lib/puppet/provider/sensu_api.rb
  10. +3 −4 lib/puppet/provider/sensu_license/sensuctl.rb
  11. +0 −6 lib/puppet/provider/sensu_user/sensuctl.rb
  12. +17 −4 lib/puppet/provider/sensuctl.rb
  13. +50 −20 lib/puppet/type/sensu_ad_auth.rb
  14. +189 −0 lib/puppet/type/sensu_agent_entity_config.rb
  15. +35 −0 lib/puppet/type/sensu_agent_entity_setup.rb
  16. +41 −0 lib/puppet/type/sensu_agent_entity_validator.rb
  17. +6 −28 lib/puppet/type/sensu_asset.rb
  18. +53 −1 lib/puppet/type/sensu_resources.rb
  19. +0 −7 lib/puppet/type/sensu_user.rb
  20. +29 −0 lib/puppet_x/sensu/agent_entity_config.rb
  21. +52 −4 manifests/agent.pp
  22. +59 −10 manifests/agent/annotation.pp
  23. +1 −1 manifests/agent/config_entry.pp
  24. +59 −10 manifests/agent/label.pp
  25. +26 −0 manifests/agent/subscription.pp
  26. +6 −0 manifests/backend.pp
  27. +40 −0 manifests/backend/agent_resources.pp
  28. +6 −13 manifests/init.pp
  29. +1 −1 metadata.json
  30. +236 −6 spec/acceptance/01_agent_spec.rb
  31. +26 −2 spec/acceptance/02_backend_cluster_spec.rb
  32. +0 −8 spec/acceptance/04_plugins_spec.rb
  33. +2 −8 spec/acceptance/sensu_ad_auth_spec.rb
  34. +0 −10 spec/acceptance/sensu_asset_spec.rb
  35. +49 −7 spec/acceptance/sensu_bolt_tasks_spec.rb
  36. +0 −5 spec/acceptance/sensu_plugin_spec.rb
  37. +57 −62 spec/acceptance/windows_spec.rb
  38. +49 −7 spec/classes/agent_spec.rb
  39. +53 −0 spec/classes/backend_agent_resources_spec.rb
  40. +2 −2 spec/classes/backend_default_resources_spec.rb
  41. +8 −1 spec/classes/backend_spec.rb
  42. +31 −0 spec/defines/agent_annotation_spec.rb
  43. +31 −0 spec/defines/agent_label_spec.rb
  44. +17 −0 spec/defines/agent_subscription_spec.rb
  45. +3 −0 spec/fixtures/tasks/backend_upgrade/logs.out
  46. +66 −0 spec/fixtures/unit/provider/sensu_agent_entity_config/sensu_api/entity_list.json
  47. +66 −0 spec/fixtures/unit/provider/sensu_agent_entity_config/sensuctl/entity_list.json
  48. +4 −5 spec/spec_helper_acceptance.rb
  49. +0 −12 spec/spec_helper_acceptance_windows.rb
  50. +32 −0 spec/tasks/backend_upgrade_spec.rb
  51. +54 −0 spec/unit/provider/sensu_agent_entity_config/sensu_api_spec.rb
  52. +41 −0 spec/unit/provider/sensu_agent_entity_config/sensuctl_spec.rb
  53. +5 −4 spec/unit/provider/sensuctl_spec.rb
  54. +2 −2 spec/unit/sensu_ad_auth_spec.rb
  55. +276 −0 spec/unit/sensu_agent_entity_config_spec.rb
  56. +0 −37 spec/unit/sensu_asset_spec.rb
  57. +1 −1 spec/unit/sensu_check_spec.rb
  58. +1 −1 spec/unit/sensu_filter_spec.rb
  59. +1 −1 spec/unit/sensu_handler_spec.rb
  60. +1 −1 spec/unit/sensu_hook_spec.rb
  61. +1 −1 spec/unit/sensu_mutator_spec.rb
  62. +63 −0 spec/unit/sensu_resources_spec.rb
  63. +46 −0 tasks/backend_upgrade.json
  64. +48 −0 tasks/backend_upgrade.rb
  65. +4 −0 tasks/install_agent.json
  66. +6 −0 tasks/install_agent_linux.rb
  67. +2 −0 tasks/install_agent_windows.ps1
  68. +11 −0 templates/agent.yml.erb
  69. +2 −0 tests/README.md
23 changes: 15 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [v5.0.0](https://github.com/sensu/sensu-puppet/tree/v5.0.0) (2020-09-08)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v4.13.1...v5.0.0)

### Changed

- Remove various deprecations [\#1273](https://github.com/sensu/sensu-puppet/pull/1273) ([treydock](https://github.com/treydock))
- Support Sensu Go 6 [\#1255](https://github.com/sensu/sensu-puppet/pull/1255) ([treydock](https://github.com/treydock))

### Added

- Remove acceptance test skipping for plugins [\#1272](https://github.com/sensu/sensu-puppet/pull/1272) ([treydock](https://github.com/treydock))
- Make sensu\_ad\_auth group\_search optional [\#1266](https://github.com/sensu/sensu-puppet/pull/1266) ([treydock](https://github.com/treydock))
- Add sensu::backend\_upgrade task [\#1265](https://github.com/sensu/sensu-puppet/pull/1265) ([treydock](https://github.com/treydock))

## [v4.13.1](https://github.com/sensu/sensu-puppet/tree/v4.13.1) (2020-08-13)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v4.13.0...v4.13.1)
Expand Down Expand Up @@ -204,8 +219,6 @@

- BREAKING: Add API providers [\#1191](https://github.com/sensu/sensu-puppet/pull/1191) ([treydock](https://github.com/treydock))
- Add several parameters to sensu::agent class [\#1185](https://github.com/sensu/sensu-puppet/pull/1185) ([treydock](https://github.com/treydock))
- Document upcoming breaking changes [\#1167](https://github.com/sensu/sensu-puppet/pull/1167) ([treydock](https://github.com/treydock))
- BREAKING: Move cli resources to sensu::cli class [\#1164](https://github.com/sensu/sensu-puppet/pull/1164) ([treydock](https://github.com/treydock))

### Added

Expand Down Expand Up @@ -256,12 +269,6 @@

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v3.10.0...v3.11.0)

### Added

- Support Windows 2019 [\#1168](https://github.com/sensu/sensu-puppet/pull/1168) ([treydock](https://github.com/treydock))
- Improve release process [\#1166](https://github.com/sensu/sensu-puppet/pull/1166) ([treydock](https://github.com/treydock))
- \(ci\) Use correct Ruby version 2.5.7 for latest Puppet 6 tests [\#1165](https://github.com/sensu/sensu-puppet/pull/1165) ([ghoneycutt](https://github.com/ghoneycutt))

### Fixed

- Document sensu\_asset deprecations [\#1170](https://github.com/sensu/sensu-puppet/pull/1170) ([treydock](https://github.com/treydock))
Expand Down
89 changes: 59 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#### Table of Contents

1. [Module Description](#module-description)
* [Deprecations](#deprecations)
* [Updating this module from 4.x to 5.x](#updating-this-module-from-4x-to-5x)
* [Updating this module from 3.x to 4.x](#updating-this-module-from-3x-to-4x)
2. [Setup - The basics of getting started with Sensu](#setup)
* [What sensu affects](#what-sensu-affects)
Expand Down Expand Up @@ -44,9 +44,9 @@

## Module description

Installs and manages [Sensu](http://sensuapp.org), the open source monitoring framework.
Installs and manages [Sensu Go](https://sensu.io/), the open source monitoring framework.

Please note, that this is a **Partner Supported** module, which means that technical customer support for this module is solely provided by Sensu. Puppet does not provide support for any **Partner Supported** modules. Technical support for this module is provided by Sensu at [https://sensuapp.org/support](https://sensuapp.org/support).
Please note, that this is a **Partner Supported** module, which means that technical customer support for this module is solely provided by Sensu. Puppet does not provide support for any **Partner Supported** modules. Technical support for this module is provided by Sensu at [https://sensu.io/support](https://sensu.io/support).

### Documented with Puppet Strings

Expand All @@ -55,54 +55,59 @@ Please note, that this is a **Partner Supported** module, which means that techn
### Compatibility - supported Sensu versions

If not explicitly stated it should always support the latest Sensu release.
Beginning with v4.0.0 this module will only support Sensu Go 5.16+.
Beginning with v5.0.0 this module will only support Sensu Go 6.0+.
Please log an issue if you identify any incompatibilities.

| Sensu Go Version| Recommended Puppet Module Version |
| --------------- | ----------------------------------- |
| 5.0 - 5.15 | latest v3 |
| 5.16+ | latest v4 |
| 6.0+ | latest v5 |

### Upgrade note

Sensu Go 5.x is a rewrite of Sensu and no longer depends on redis and rabbitmq.
Version 3 of this module supports Sensu Go 5.0.0 to 5.15.x.
Version 4 of this module supports Sensu Go 5.16+.
Version 3 of this module supports Sensu Go >= 5.0.0 to < 5.16.0.
Version 4 of this module supports Sensu Go >= 5.16.0 < 6.0.0.
Version 5 of this module supports Sensu Go >= 6.0.0 < 7.0.0.

Users wishing to use the previous Ruby based Sensu should use the [sensu/sensuclassic](https://forge.puppet.com/sensu/sensuclassic) module.

### Deprecations
### Updating this module from 4.x to 5.x

#### sensu\_asset
This module begins supporting Sensu Go 6 with version >= 5.0.0

The `url`, `sha512`, `filters` and `headers` properties for `sensu_asset` are deprecated in favor of passing these values as part of `builds` property.
Using these deprecated properties will still work but issue a warning when the Puppet catalog is applied.
**NOTE** Upgrading to support Sensu Go 6 requires backends have Puppet applied before agents will begin to work as there is an agent specifc Sensu user and role added to support modifying agent entities via the API.

Before:
#### Changes for backend

```puppet
sensu_asset { 'test':
ensure => 'present',
url => 'http://example.com/asset/example.tar',
sha512 => '4f926bf4328fbad2b9cac873d117f771914f4b837c9c85584c38ccf55a3ef3c2e8d154812246e5dda4a87450576b2c58ad9ab40c9e2edc31b288d066b195b21b',
filters => ["entity.system.os == 'linux'"],
}
```
There is a manual step to perform to upgrade the sensu-backend after upgrading the backend to 6.x.
This module provides the `sensu::backend_upgrade` bolt task as a way to execute the necessary `sensu-backend upgrade` command.

After:
```puppet
sensu_asset { 'test':
ensure => 'present',
builds => [
{
'url' => 'http://example.com/asset/example.tar',
'sha512' => '4f926bf4328fbad2b9cac873d117f771914f4b837c9c85584c38ccf55a3ef3c2e8d154812246e5dda4a87450576b2c58ad9ab40c9e2edc31b288d066b195b21b',
'filters' => ["entity.system.os == 'linux'"],
},
],
#### Changes for agents

Beginning with Sensu Go 6, some changes to `agent.yml` will only bootstrap an agent entity, they will not update the entity.
If you wish to make changes to values such as `subscriptions`, `labels` or `annotations` after a host is added to Sensu this must be done
via the Sensu Go API. To support this it's now required that agents have the ability to make API calls.

In order to ensure agents can make API calls either via API or sensuctl the agent must be told about the admin password:

```
class { 'sensu':
agent_entity_config_password => 'supersecret',
}
class { 'sensu::agent':
...
}
```

See [API Providers](#api-providers) for example Hiera that can be used in a file like `common.yaml` to easily share the admin password with agents.

This module will still continue to write subscriptions and other agent configurations to `agent.yml` so that if an agent entity is deleted it can be recreated
by restarting the `sensu-agent` service.

**NOTE**: At this time redaction of labels or annotations is not supported and will cause this module to produce errors. See [limitations](#limitations) for details.

### Updating this module from 3.x to 4.x

Class parameter changes:
Expand Down Expand Up @@ -240,6 +245,10 @@ The following example will manage resources necessary to configure a sensu-agent
associated to `linux` and `apache-servers` subscriptions.

```puppet
class { 'sensu':
api_host => 'sensu-backend.example.com',
agent_entity_config_password => 'supersecret',
}
class { 'sensu::agent':
backends => ['sensu-backend.example.com:8081'],
subscriptions => ['linux', 'apache-servers'],
Expand Down Expand Up @@ -299,6 +308,7 @@ sensu::api_host: sensu-backend.example.com
sensu::api_port: 8080
sensu::username: admin
sensu::password: supersecret
sensu::agent_entity_config_password: supersecret
```
### Manage Windows Agent
Expand Down Expand Up @@ -825,6 +835,17 @@ sensu_resources { 'sensu_check':
}
```

To selectively purge `sensu_agent_entity_config` entries, you can specify the type of config to purge.
If `agent_entity_configs` is omitted then all unmanaged `sensu_agent_entity_config` resources will be purged.
The following example will only purge subscriptions:

```puppet
sensu_resources { 'sensu_agent_entity_config':
purge => true,
agent_entity_configs => ['subscriptions'],
}
```

**NOTE**: The Puppet built-in `resources` can also be used for purging but you must ensure that resources that support namespaces are defined using composite names in the form of `$name in $namespace`. See [Composite Names for Namespaces](#composite-names-for-namespaces) for details on composite names.

Using the Puppet built-in `resources` would look like this:
Expand Down Expand Up @@ -1047,6 +1068,10 @@ sensu_bonsai_asset { 'sensu/sensu-pagerduty-handler':

The following Bolt tasks are provided by this Module:

**sensu::backend\_upgrade**: Perform backend upgrade via `sensu-backend upgrade` command.

Example: `bolt task run sensu::backend_upgrade --targets sensu_backend`

**sensu::agent\_event**: Create a Sensu Go agent event via the agent API

Example: `bolt task run sensu::agent_event name=bolttest status=1 output=test --targets sensu_agent`
Expand Down Expand Up @@ -1187,6 +1212,10 @@ Examples can be found in the [examples](https://github.com/sensu/sensu-puppet/tr

## Limitations

Sensu Go 6 support of this module can not support redacted labels or annotations due to how agent entity API calls are made.
At this time this module will produce errors if redacted labels or annotations are encountered.
See [sensu-go#3955](https://github.com/sensu/sensu-go/issues/3955) for details on this issue.

The type `sensu_user` does not at this time support `ensure => absent` due to a limitation with sensuctl, see [sensu-go#2540](https://github.com/sensu/sensu-go/issues/2540).

When changing the `sensu::password` value, it's necessary to run Puppet on the backend first to update the `admin` password.
Expand Down
Loading