Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent v6 by default #594

Merged
merged 18 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .kitchen.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ suites:
- recipe[datadog::dd-agent]
attributes:
datadog:
# TODO(remy): run those tests with Agent v6 recipe.
agent6: false
api_key: somenonnullapikeythats32charlong
application_key: alsonotnil
73 changes: 59 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Chef recipes to deploy Datadog's components and configuration automatically.
This cookbook includes support for:

* Datadog Agent version 6.0 and up: please refer to
the [dedicated section](#agent-6-support) and the [inline docs](https://github.com/DataDog/chef-datadog/blob/v2.15.0/attributes/default.rb#L31-L75)
the [dedicated section](#agent-v6) and the [inline docs](https://github.com/DataDog/chef-datadog/blob/v3.0.0/attributes/default.rb#L42-L76)
for more details on how to use it
remeh marked this conversation as resolved.
Show resolved Hide resolved
* Datadog Agent version 5.x

Expand Down Expand Up @@ -175,22 +175,23 @@ end

See `recipes/` for many examples using the `datadog_monitor` resource.

Cookbook history
remeh marked this conversation as resolved.
Show resolved Hide resolved
================

- `>= 3.0.0`: the cookbook supports installing either Agent v5 or v6, defaulting to Agent v6.
- `>= 2.15.0`: add support to install either Agent v5 or Agent v6 on Windows, defaulting to Agent v5.
- `>= 2.14.0`: the cookbook supports installing either Agent v5 or Agent v6 on Linux, defaulting to Agent v5.
- `< 2.14.0`: the cookbook only supports Agent v5.

Usage
=====

### Agent 6 Support
Please note the cookbook now supports installing both Agent v5 and Agent v6 of the Datadog Agent on Linux (since v2.14.0) and Windows (since v2.15.0). By default versions `<=2.x` of the cookbook will default to install Agent5, you may however override this behavior with the `node['datadog']['agent6']` attribute.
```
default_attributes(
'datadog' => {
'agent6' => true
}
)
```
### Agent v6

By default, this cookbook installs Agent v6, if you want to install Agent v5, please refer to the Agent v5 section below.

Note: to _upgrade_ to Agent 6 on a node with Agent 5 already installed, you also have to pin `agent6_version` to a v6 version (recommended), or set `agent6_package_action` to `'upgrade'`.
Attributes are available to have finer control over how you install Agent v6:

Additional attributes are available to have finer control over how you install Agent 6. These are Agent 6 counterparts to several well known Agent 5 attributes (code [here](https://github.com/DataDog/chef-datadog/blob/master/attributes/default.rb#L31-L75)):
* `agent6_version`: allows you to pin the agent version (recommended).
remeh marked this conversation as resolved.
Show resolved Hide resolved
* `agent6_package_action`: defaults to `'install'`, may be set to `'upgrade'` to automatically upgrade to latest (not recommended, we recommend pinning to a version with `agent6_version` and change that version to upgrade).
* `agent6_aptrepo`: desired APT repo for the agent. Defaults to `http://apt.datadoghq.com`
Expand All @@ -199,7 +200,51 @@ Additional attributes are available to have finer control over how you install A

Please review the [attributes/default.rb](https://github.com/DataDog/chef-datadog/blob/master/attributes/default.rb) file (at the version of the cookbook you use) for the list and usage of the attributes used by the cookbook.

For general information on the Datadog Agent 6, please refer to the [datadog-agent](https://github.com/DataDog/datadog-agent/) repo.
For general information on the Datadog Agent v6, please refer to the [datadog-agent](https://github.com/DataDog/datadog-agent/) repo.

### Agent v5

Since `3.0.0`, the cookbook defaults installing Agent v6. You can still setup the Agent v5 by setting `node['datadog']['agent6']` to false.

```
default_attributes(
'datadog' => {
'agent6' => false
}
)
```

### Agent v5 transitions

#### Upgrade from Agent v5 to Agent v6

To upgrade from an already installed Agent v5 to Agent v6, you'll have to set the `agent6_package_action` to `upgrade` and we recommend to pin to a specific version:

```ruby
remeh marked this conversation as resolved.
Show resolved Hide resolved
default_attributes(
'datadog' => {
'agent6' => true,
'agent6_version' => '1:6.10.0-1', # optional but recommended
'agent6_package_action' => 'upgrade',
remeh marked this conversation as resolved.
Show resolved Hide resolved
}
)
```

Note that there are Agent v6 counterparts to several well known Agent v5 attributes (code [here](https://github.com/DataDog/chef-datadog/blob/master/attributes/default.rb#L31-L75))

#### Downgrade from an installed Agent v6 to an Agent v5

You will need to indicate that you want to setup an Agent v5 instead of v6, pin the Agent v5 version that you want to install and allow downgrade:

```ruby
default_attributes(
'datadog' => {
'agent6' => false,
'agent_version' => '1:5.32.0-1',
'agent_allow_downgrade' => true
}
)
```

#### Windows Agent v6 installation
remeh marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -237,7 +282,7 @@ file `datadog.yaml`.

1. Add this cookbook to your Chef Server, either by installing with knife or by adding it to your Berksfile:
```
cookbook 'datadog', '~> 2.14.0'
cookbook 'datadog', '~> 3.0.0'
```
2. Add your API Key either:
* as a node attribute via an `environment` or `role`, or
Expand Down
19 changes: 9 additions & 10 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,7 @@
# Set it as an attribute, or on your node `run_state` under the key `['datadog']['application_key']`
default['datadog']['application_key'] = nil

########################################################################
### Agent6-only attributes ###

# If you're installing a pre-release version of Agent 6 (beta or RC), you need to:
# * on debian: set node['datadog']['agent6_aptrepo_dist'] to 'beta' instead of 'stable'
# * on RHEL: set node['datadog']['agent6_yumrepo'] to 'https://yum.datadoghq.com/beta/x86_64/'
# In all cases, follow the instructions below:

# Set node['datadog']['agent6'] to true to install an agent6 instead of agent5.
# Set node['datadog']['agent6'] to false to install an agent5 instead of agent6.
# To upgrade from agent5 to agent6, you need to:
# * set node['datadog']['agent6'] to true, and
# * either set node['datadog']['agent6_version'] to an existing agent6 version (recommended), or
Expand All @@ -45,7 +37,14 @@
# * set node['datadog']['agent6'] to false, and
# * pin node['datadog']['agent_version'] to an existing agent5 version, and
# * set node['datadog']['agent_allow_downgrade'] to true
default['datadog']['agent6'] = false
# If you're installing a pre-release version of Agent 6 (beta or RC), you need to:
# * on debian: set node['datadog']['agent6_aptrepo_dist'] to 'beta' instead of 'stable'
# * on RHEL: set node['datadog']['agent6_yumrepo'] to 'https://yum.datadoghq.com/beta/x86_64/'
default['datadog']['agent6'] = true

########################################################################
### Agent6-only attributes ###

# Default of `nil` will install latest version, applies to agent6 only.
# See documentation of `agent_version` attribute for allowed configuration format.
default['datadog']['agent6_version'] = nil
Expand Down
Loading