24 changes: 15 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

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

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v4.7.1...v4.8.0)

### Added

- Support defining agent annotations, labels and config entrys via defined type [\#1240](https://github.com/sensu/sensu-puppet/pull/1240) ([treydock](https://github.com/treydock))

## [v4.7.1](https://github.com/sensu/sensu-puppet/tree/v4.7.1) (2020-04-07)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v4.7.0...v4.7.1)
Expand Down Expand Up @@ -36,6 +44,7 @@
- Allow agents to have subscriptions defined as a resource [\#1227](https://github.com/sensu/sensu-puppet/pull/1227) ([treydock](https://github.com/treydock))
- Support bonsai version with v prefix [\#1223](https://github.com/sensu/sensu-puppet/pull/1223) ([treydock](https://github.com/treydock))
- Manage license through sensu\_license type [\#1218](https://github.com/sensu/sensu-puppet/pull/1218) ([treydock](https://github.com/treydock))
- Add more examples [\#1214](https://github.com/sensu/sensu-puppet/pull/1214) ([treydock](https://github.com/treydock))

### Fixed

Expand All @@ -52,7 +61,6 @@

### Added

- Add more examples [\#1214](https://github.com/sensu/sensu-puppet/pull/1214) ([treydock](https://github.com/treydock))
- Better organization of class variables [\#1213](https://github.com/sensu/sensu-puppet/pull/1213) ([treydock](https://github.com/treydock))
- Better documentation of private types [\#1212](https://github.com/sensu/sensu-puppet/pull/1212) ([treydock](https://github.com/treydock))

Expand Down Expand Up @@ -157,6 +165,10 @@

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

### Added

- Support defining agent and backend service environment variables [\#1160](https://github.com/sensu/sensu-puppet/pull/1160) ([treydock](https://github.com/treydock))

## [v3.13.0](https://github.com/sensu/sensu-puppet/tree/v3.13.0) (2019-11-26)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v3.12.0...v3.13.0)
Expand Down Expand Up @@ -208,19 +220,17 @@

### Added

- Support defining agent and backend service environment variables [\#1160](https://github.com/sensu/sensu-puppet/pull/1160) ([treydock](https://github.com/treydock))
- Deprecate defining single asset builds [\#1140](https://github.com/sensu/sensu-puppet/pull/1140) ([treydock](https://github.com/treydock))
- Initial work at design document [\#1161](https://github.com/sensu/sensu-puppet/pull/1161) ([treydock](https://github.com/treydock))
- Add bolt tasks [\#1153](https://github.com/sensu/sensu-puppet/pull/1153) ([treydock](https://github.com/treydock))

## [v3.9.0](https://github.com/sensu/sensu-puppet/tree/v3.9.0) (2019-10-10)

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

### Added

- Initial work at design document [\#1161](https://github.com/sensu/sensu-puppet/pull/1161) ([treydock](https://github.com/treydock))
- Add sensu\_resources type that will handle resource purging [\#1158](https://github.com/sensu/sensu-puppet/pull/1158) ([treydock](https://github.com/treydock))
- Add sensu\_gem package provider [\#1156](https://github.com/sensu/sensu-puppet/pull/1156) ([treydock](https://github.com/treydock))
- Add bolt tasks [\#1153](https://github.com/sensu/sensu-puppet/pull/1153) ([treydock](https://github.com/treydock))
- Install Windows agent via chocolatey [\#1152](https://github.com/sensu/sensu-puppet/pull/1152) ([treydock](https://github.com/treydock))
- Add sensu\_bonsai\_asset type [\#1149](https://github.com/sensu/sensu-puppet/pull/1149) ([treydock](https://github.com/treydock))
- Replace unit test instance variables with let [\#1143](https://github.com/sensu/sensu-puppet/pull/1143) ([treydock](https://github.com/treydock))
Expand All @@ -234,10 +244,6 @@

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

### Added

- Testing improvements [\#1139](https://github.com/sensu/sensu-puppet/pull/1139) ([treydock](https://github.com/treydock))

## [v3.7.0](https://github.com/sensu/sensu-puppet/tree/v3.7.0) (2019-08-26)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v3.6.0...v3.7.0)
Expand Down
65 changes: 60 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* [Manage Windows Agent](#manage-windows-agent)
* [Advanced agent](#advanced-agent)
* [Advanced agent - Subscriptions](#advanced-agent---subscriptions)
* [Advanced agent - Annotations and Labels](#advanced-agent---annotations-and-labels)
* [Advanced agent - Custom config entries](#advanced-agent---custom-config-entries)
* [Advanced SSL](#advanced-ssl)
* [Enterprise support](#enterprise-support)
* [Contact routing](#contact-routing)
Expand Down Expand Up @@ -218,7 +220,7 @@ The output should look like the following:

The following example will configure sensu-backend, sensu-agent on backend and add a check.
By default this module will configure the backend to use Puppet's SSL certificate and CA.
It's advisable to not rely on the default password. Changing the password requires providing the previous password via `old_password`.
It is advisable to not rely on the default password. Changing the password requires providing the previous password via `old_password`.

```puppet
class { 'sensu':
Expand Down Expand Up @@ -346,7 +348,7 @@ class { 'sensu::agent':
### Advanced agent

If you wish to change the `agent` password you must provide the new and old password.
It's advisable to set `show_diff` to `false` to avoid exposing the agent password.
It is advisable to set `show_diff` to `false` to avoid exposing the agent password.

```puppet
class { 'sensu::backend':
Expand All @@ -363,7 +365,7 @@ class { 'sensu::agent':

### Advanced agent - Subscriptions

It's possible to define subscriptions in many locations and the values merged into `agent.yml`:
It is possible to define subscriptions in many locations and the values merged into `agent.yml`:

```
class { 'sensu::agent':
Expand All @@ -379,6 +381,59 @@ sensu::agent::subscription { 'apache': }

The resulting `agent.yml` would contain subscriptions for both `base` and `apache`.

**NOTE**: Subscriptions defined using the `sensu::agent` class and `sensu::agent::subscription` are merged to produce the final subscription array.

### Advanced agent - Annotations and Labels

It is possible to define annotations and labels in many locations and the values merged into `agent.yml`:

```puppet
class { 'sensu::agent':
labels => { 'location' => 'uswest', 'contacts' => 'ops@example.com' },
annotations => { 'cpu.warning' => '90', 'cpu.critical' => '100' },
}
```

Then in a profile class you can define the following:

```puppet
sensu::agent::label { 'contacts': value => 'devs@example.com' }
sensu::agent::label { 'environment': value => 'dev' }
sensu::agent::annotation { 'cpu.warning': value => '75' }
sensu::agent::annotation { 'fatigue_check/occurrences': value => '2' }
```

The resulting `agent.yml` will contain the following:

```yaml
labels:
location: uswest
contacts: devs@example.com
environment: dev
annotations:
cpu.warning: '75'
cpu.critical: '100'
fatigue_check/occurrences: '2'
```
**NOTE** `sensu::agent::annotation` and `sensu::agent::label` take precedence over values set by the class `sensu::agent`

### Advanced agent - Custom config entries

It is possible to define config entries for `agent.yml` in many locations in Puppet:

```puppet
sensu::agent::config_entry { 'keepalive-interval': value => 20 }
```

This would add the following to `agent.yml`:

```yaml
keepalive-interval: 20
```

**NOTE** `sensu::agent::config_entry` takes precendence over values defined in `sensu::agent` class.

### Advanced SSL

By default this module uses Puppet's SSL certificates and CA.
Expand Down Expand Up @@ -823,7 +878,7 @@ The first step will not fully add the node to the cluster until the second step
### Sensu backend federation

This module supports defining Etcd replicators which allows resources to be sent from one Sensu cluster to another cluster.
It's necessary that Etcd be listening on an interface that can be accessed by other Sensu backends.
It is necessary that Etcd be listening on an interface that can be accessed by other Sensu backends.
First configure backend Etcd to listen on an interface besides localhost and also use SSL:

```puppet
Expand Down Expand Up @@ -869,7 +924,7 @@ sensu_cluster_federation { 'us-west-2a':
}
```

It's also possible to add a backend to an existing Sensu federated cluster.
It is also possible to add a backend to an existing Sensu federated cluster.
The following example adds the API URL https://sensu-backend-site3.example.com:8080 to the federated cluster named us-west-2a.

```puppet
Expand Down
117 changes: 117 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ _Private Classes_

**Defined types**

* [`sensu::agent::annotation`](#sensuagentannotation): Add agent annotation
* [`sensu::agent::config_entry`](#sensuagentconfig_entry): Add custom agent config entry
* [`sensu::agent::label`](#sensuagentlabel): Add agent label
* [`sensu::agent::subscription`](#sensuagentsubscription): Add agent subscription

**Resource types**
Expand Down Expand Up @@ -1098,6 +1101,120 @@ Default value: {}

## Defined types

### sensu::agent::annotation

Add agent annotation

#### Examples

#####

```puppet
sensu::agent::annotation { 'fatigue_check/occurrences:': value => '2' }
```

#### Parameters

The following parameters are available in the `sensu::agent::annotation` defined type.

##### `key`

Data type: `String[1]`

Key of the annotation to add to agent.yml, defaults to `$name`.

Default value: $name

##### `value`

Data type: `String[1]`

Label value to add to agent.yml

##### `order`

Data type: `String[1]`

Order of the datacat fragment

Default value: '50'

### sensu::agent::config_entry

Add custom agent config entry

#### Examples

#####

```puppet
sensu::agent::config_entry { 'disable-api'': value => true }
```

#### Parameters

The following parameters are available in the `sensu::agent::config_entry` defined type.

##### `key`

Data type: `String[1]`

Key of the config entry to add to agent.yml, defaults to `$name`.

Default value: $name

##### `value`

Data type: `Any`

Config entry value to add to agent.yml

##### `order`

Data type: `String[1]`

Order of the datacat fragment

Default value: '50'

### sensu::agent::label

Add agent label

#### Examples

#####

```puppet
sensu::agent::label { 'contacts': value => 'ops@example.com' }
```

#### Parameters

The following parameters are available in the `sensu::agent::label` defined type.

##### `key`

Data type: `String[1]`

Key of the label to add to agent.yml, defaults to `$name`.

Default value: $name

##### `value`

Data type: `String[1]`

Label value to add to agent.yml

##### `order`

Data type: `String[1]`

Order of the datacat fragment

Default value: '50'

### sensu::agent::subscription

Add agent subscription
Expand Down
25 changes: 25 additions & 0 deletions manifests/agent/annotation.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# @summary Add agent annotation
#
# @example
# sensu::agent::annotation { 'fatigue_check/occurrences:': value => '2' }
#
# @param key
# Key of the annotation to add to agent.yml, defaults to `$name`.
# @param value
# Label value to add to agent.yml
# @param order
# Order of the datacat fragment
#
define sensu::agent::annotation (
String[1] $value,
String[1] $key = $name,
String[1] $order = '50',
) {
datacat_fragment { "sensu_agent_config-annotation-${name}":
target => 'sensu_agent_config',
data => {
'annotations' => { $key => $value },
},
order => $order,
}
}
25 changes: 25 additions & 0 deletions manifests/agent/config_entry.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# @summary Add custom agent config entry
#
# @example
# sensu::agent::config_entry { 'disable-api'': value => true }
#
# @param key
# Key of the config entry to add to agent.yml, defaults to `$name`.
# @param value
# Config entry value to add to agent.yml
# @param order
# Order of the datacat fragment
#
define sensu::agent::config_entry (
Any $value,
String[1] $key = $name,
String[1] $order = '50',
) {
datacat_fragment { "sensu_agent_config-entry-${name}":
target => 'sensu_agent_config',
data => {
$key => $value,
},
order => $order,
}
}
25 changes: 25 additions & 0 deletions manifests/agent/label.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# @summary Add agent label
#
# @example
# sensu::agent::label { 'contacts': value => 'ops@example.com' }
#
# @param key
# Key of the label to add to agent.yml, defaults to `$name`.
# @param value
# Label value to add to agent.yml
# @param order
# Order of the datacat fragment
#
define sensu::agent::label (
String[1] $value,
String[1] $key = $name,
String[1] $order = '50',
) {
datacat_fragment { "sensu_agent_config-label-${name}":
target => 'sensu_agent_config',
data => {
'labels' => { $key => $value },
},
order => $order,
}
}
Loading