Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
22daa4d
Agent 7 support
KSerrania Nov 4, 2019
8e33e03
Use concatenation in jinja template
KSerrania Nov 7, 2019
8298114
Update README
KSerrania Nov 14, 2019
37cdf38
Update local tests
KSerrania Nov 14, 2019
f084c74
Add Agent 7 local test files
KSerrania Nov 18, 2019
cf2e56b
Merge branch 'master' into kserrania/agent7-support
KSerrania Nov 18, 2019
56563e9
Merge remote-tracking branch 'origin/master' into kserrania/agent7-su…
KSerrania Nov 20, 2019
12a4099
Update README with typo fixes and new Windows behavior
KSerrania Nov 20, 2019
617ffb8
README typo fixes
KSerrania Nov 20, 2019
26d0d1a
Address review comments
KSerrania Nov 25, 2019
e38b0e4
Address review comments
KSerrania Dec 9, 2019
4d99593
Documentation update
KSerrania Dec 10, 2019
102d6ba
Merge remote-tracking branch 'origin/master' into kserrania/agent7-su…
KSerrania Dec 12, 2019
1e76b78
Infer major version from datadog_agent_version (#239)
KSerrania Dec 16, 2019
90c5995
Do not run_once version parsing
KSerrania Dec 17, 2019
cc6ade5
More specific repo filenames
KSerrania Dec 17, 2019
ebdaca5
Use yaml dicts instead of python dicts
KSerrania Dec 17, 2019
01d0d23
Update repo filenames everywhere
KSerrania Dec 17, 2019
59d2c75
Apply suggestions from code review
KSerrania Dec 17, 2019
fc23dd9
README update
KSerrania Dec 17, 2019
7c5abe3
Update version parsing regexp
KSerrania Dec 17, 2019
1e4eb78
We're releasing v4, not v3
KSerrania Dec 17, 2019
6becf1c
Simplify demo playbook
KSerrania Dec 17, 2019
6770120
Add 4.0 changelog
KSerrania Dec 17, 2019
8420dac
Merge branch 'master' into kserrania/agent7-support
KSerrania Dec 17, 2019
f120e97
Changelog tweaks
KSerrania Dec 17, 2019
9dd8ee9
Changelog tweaks 2
KSerrania Dec 18, 2019
1882eae
Merge branch 'master' into kserrania/agent7-support
KSerrania Dec 18, 2019
a8927e1
Update README.md
KSerrania Dec 18, 2019
8a56d48
Put internal variables at the end of the defaults file
KSerrania Dec 18, 2019
780f15a
Update changelog date
KSerrania Dec 18, 2019
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
73 changes: 73 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ version: 2
- run: dd-agent info || true
- run: ps aux | grep -v grep | grep datadog-agent

# install the latest version of agent5, upgrade to the latest agent7 and downgrade to an old agent5
.install_agent_7: &install_agent_7
steps:
- checkout
# dry run
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/install_agent_7.yaml" --check
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/downgrade_to_5_${OS_TYPE}.yaml" --check

# install latest agent5
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/install_agent_5.yaml"
- run: dd-agent info || true
- run: ps aux | grep -v grep | grep datadog-agent

# upgrade to the latest agent6
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/install_agent_7.yaml"
- run: datadog-agent version

# downgrading to 5.23.0
- run: ansible-playbook -i ./ci_test/inventory/ci.ini "./ci_test/downgrade_to_5_${OS_TYPE}.yaml"
- run: dd-agent info || true
- run: ps aux | grep -v grep | grep datadog-agent

jobs:

ansible_lint:
Expand Down Expand Up @@ -139,6 +161,50 @@ jobs:
- OS_TYPE: "centos"
<<: *install_agent_6

# Agent 7

debian_26_7:
docker:
- image: datadog/docker-library:ansible_debian_2_6
environment:
- OS_TYPE: "debian"
<<: *install_agent_7

centos_26_7:
docker:
- image: datadog/docker-library:ansible_centos_2_6
environment:
- OS_TYPE: "centos"
<<: *install_agent_7

debian_27_7:
docker:
- image: datadog/docker-library:ansible_debian_2_7
environment:
- OS_TYPE: "debian"
<<: *install_agent_7

centos_27_7:
docker:
- image: datadog/docker-library:ansible_centos_2_7
environment:
- OS_TYPE: "centos"
<<: *install_agent_7

debian_28_7:
docker:
- image: datadog/docker-library:ansible_debian_2_8
environment:
- OS_TYPE: "debian"
<<: *install_agent_7

centos_28_7:
docker:
- image: datadog/docker-library:ansible_centos_2_8
environment:
- OS_TYPE: "centos"
<<: *install_agent_7

workflows:
version: 2
test_datadog_role:
Expand All @@ -149,20 +215,27 @@ workflows:
# ansible 2.6
- debian_26_5
- debian_26_6
- debian_26_7
# ansible 2.7
- debian_27_5
- debian_27_6
- debian_27_7
# ansible 2.8
- debian_28_5
- debian_28_6
- debian_28_7

# test centos (rpm)
# ansible 2.6
- centos_26_5
- centos_26_6
- centos_26_7
# ansible 2.7
- centos_27_5
- centos_27_6
- centos_27_7
# ansible 2.8
- centos_28_5
- centos_28_6
- centos_28_7

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CHANGELOG
=========

# 4.0.0 / 2019-12-18

**This role will install Agent v7 by default.** Datadog Agent v7 runs checks with Python 3, so if you were running any custom checks written in Python, they must be compatible with Python 3. If you were not running any custom checks or if your custom checks are already compatible with Python 3, then it is safe to upgrade to Agent v7.

* [MAJOR] Agent 7 support. See [#220][].
* Refer to the [role upgrade section](README.md#role-upgrade-from-v3-to-v4) of the docs for the complete list of changes and instructions to upgrade this role from v3 to v4.
* [FEATURE] Infer major version from `datadog_agent_version`. See [#239][].
* [FEATURE] Allow pinned version install on multiple platforms at the same time. See [#235][].

# 3.4.0 / 2019-12-18

* [FEATURE] Reset pinned Windows version. See [#234][].
Expand Down Expand Up @@ -146,9 +155,12 @@ Initial release, compatible with Ansible v1 & v2
[#107]: https://github.com/DataDog/ansible-datadog/issues/107
[#116]: https://github.com/DataDog/ansible-datadog/issues/116
[#203]: https://github.com/DataDog/ansible-datadog/issues/203
[#220]: https://github.com/DataDog/ansible-datadog/issues/220
[#224]: https://github.com/DataDog/ansible-datadog/issues/224
[#233]: https://github.com/DataDog/ansible-datadog/issues/233
[#234]: https://github.com/DataDog/ansible-datadog/issues/234
[#235]: https://github.com/DataDog/ansible-datadog/issues/235
[#239]: https://github.com/DataDog/ansible-datadog/issues/239
[@brendanlong]: https://github.com/brendanlong
[@dbr1993]: https://github.com/dbr1993
[@enarciso]: https://github.com/enarciso
Expand Down
101 changes: 75 additions & 26 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ci_test/downgrade_to_5_centos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- { role: '/root/project/'}
vars:
datadog_api_key: "11111111111111111111111111111111"
datadog_agent5: true
datadog_agent_major_version: 5
datadog_agent_version: 5.23.0-1
datadog_agent_allow_downgrade: yes
datadog_config:
Expand Down
2 changes: 1 addition & 1 deletion ci_test/downgrade_to_5_debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- { role: '/root/project/'}
vars:
datadog_api_key: "11111111111111111111111111111111"
datadog_agent5: true
datadog_agent_major_version: 5
datadog_agent_version: 1:5.23.0-1
datadog_agent_allow_downgrade: yes
datadog_config:
Expand Down
2 changes: 1 addition & 1 deletion ci_test/install_agent_5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- { role: '/root/project/'}
vars:
datadog_api_key: "11111111111111111111111111111111"
datadog_agent5: true
datadog_agent_major_version: 5
# avoid checking that the agent is stopped for centos
datadog_skip_running_check: true
datadog_config:
Expand Down
1 change: 1 addition & 0 deletions ci_test/install_agent_6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
vars:
datadog_api_key: "11111111111111111111111111111111"
datadog_enabled: false
datadog_agent_major_version: 6
# avoid checking that the agent is stopped for centos
datadog_skip_running_check: true
datadog_config:
Expand Down
26 changes: 26 additions & 0 deletions ci_test/install_agent_7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---

- hosts: all
roles:
- { role: '/root/project/'}
vars:
datadog_api_key: "11111111111111111111111111111111"
datadog_enabled: false
datadog_agent_major_version: 7
# avoid checking that the agent is stopped for centos
datadog_skip_running_check: true
datadog_config:
tags: "mytag0, mytag1"
log_level: INFO
apm_enabled: "true" # has to be set as a string
datadog_config_ex:
trace.config:
env: dev
trace.concentrator:
extra_aggregators: version
datadog_checks:
process:
init_config:
instances:
- name: agent
search_string: ['agent', 'sshd' ]
88 changes: 62 additions & 26 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,52 @@ datadog_agent_binary_path_windows: "C:\\Program Files\\Datadog\\Datadog Agent\\b
# list of additional groups for datadog_user
datadog_additional_groups: {}

# default apt repo
datadog_apt_repo: "deb https://apt.datadoghq.com/ stable 6"
# Major version of the Agent that will be installed.
# Possible values: 5, 6, 7
# By default, version 7 will be installed.
# If datadog_agent_version is defined, the major version will be deduced from it.
datadog_agent_major_version: ""

# Pin agent to a version. Highly recommended.
# Defaults to the latest version of the major version chosen in datadog_agent_major_version
# If both datadog_agent_major_version and datadog_agent_version are set, they must be
# compatible (ie. the major version in datadog_agent_version must be datadog_agent_major_version)
datadog_agent_version: ""

# Default apt repo and keyserver

# By default, the roll uses the official apt Datadog repository for the chosen major version
# Use the datadog_apt_repo variable to override the repository used.
datadog_apt_repo: ""


datadog_apt_cache_valid_time: 3600
datadog_apt_key_retries: 5
use_apt_backup_keyserver: false
datadog_apt_keyserver: hkp://keyserver.ubuntu.com:80
datadog_apt_backup_keyserver: hkp://pool.sks-keyservers.net:80

# default yum repo and keys
datadog_yum_repo: "https://yum.datadoghq.com/stable/6/{{ ansible_userspace_architecture }}/"
# Default yum repo and keys

# By default, the roll uses the official yum Datadog repository for the chosen major version
# Use the datadog_yum_repo variable to override the repository used.
datadog_yum_repo: ""

datadog_yum_gpgkey: "https://yum.datadoghq.com/DATADOG_RPM_KEY.public"
datadog_yum_gpgkey_e09422b3: "https://yum.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public"
datadog_yum_gpgkey_e09422b3_sha256sum: "694a2ffecff85326cc08e5f1a619937999a5913171e42f166e13ec802c812085"

# default zypper repo and keys
datadog_zypper_repo: "https://yum.datadoghq.com/suse/stable/6/{{ ansible_userspace_architecture }}"
# Default zypper repo and keys

# By default, the roll uses the official zypper Datadog repository for the chosen major version
# Use the datadog_zypper_repo variable to override the repository used.
datadog_zypper_repo: ""

datadog_zypper_gpgkey: "https://yum.datadoghq.com/DATADOG_RPM_KEY.public"
datadog_zypper_gpgkey_sha256sum: "00d6505c33fd95b56e54e7d91ad9bfb22d2af17e5480db25cba8fee500c80c46"
datadog_zypper_gpgkey_e09422b3: "https://yum.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public"
datadog_zypper_gpgkey_e09422b3_sha256sum: "694a2ffecff85326cc08e5f1a619937999a5913171e42f166e13ec802c812085"

# Pin agent to a version. Highly recommended.
datadog_agent_version: ""

# Avoid checking if the agent is running or not. This can be useful if you're
# using sysvinit and providing your own init script.
datadog_skip_running_check: false
Expand All @@ -56,9 +78,22 @@ datadog_skip_running_check: false
# On centos this will only work with ansible 2.4 and up
datadog_agent_allow_downgrade: no

# default datadog windows download url
datadog_windows_download_url: "https://s3.amazonaws.com/ddagent-windows-stable/datadog-agent-6-latest.amd64.msi"
# Default windows latest msi package URL

# By default, will use the official latest msi package for the chosen major version.
# Use the datadog_windows_download_url option to override the msi package used.
datadog_windows_download_url: ""

# The default msi package for each major Agent version is specified in the following variables.
# These variables are for internal use only, do not modify them.
datadog_windows_agent6_latest_url: "https://s3.amazonaws.com/ddagent-windows-stable/datadog-agent-6-latest.amd64.msi"
datadog_windows_agent7_latest_url: "https://s3.amazonaws.com/ddagent-windows-stable/datadog-agent-7-latest.amd64.msi"

# If datadog_agent_version is set, the role will use the following url prefix instead, and append the version number to it
# in order to get the full url to the msi package.
datadog_windows_versioned_url: "https://s3.amazonaws.com/ddagent-windows-stable/ddagent-cli"

# url of the 6.14 fix script. See http://dtdg.co/win-614-fix for more details.
datadog_windows_614_fix_script_url: "https://s3.amazonaws.com/ddagent-windows-stable/scripts/fix_6_14.ps1"

# Override to change the name of the windows user to create
Expand All @@ -70,22 +105,23 @@ datadog_windows_ddagentuser_password: ""
# arguments to supply to the windows installer.
win_install_args: " "

########################################################################
### Installing agent5 ###

# To install agent5 instead of agent6 you need to:
# * set 'datadog_agent5' to true
datadog_agent5: no
#
# Internal variables
# The following variables are for internal use only, do not modify them.
#

# To downgrade from agent6 to agent5, you need to:
# * set 'datadog_agent5' to true
# * pin 'datadog_agent_version' to an existing agent5 version
# * set 'datadog_agent_allow_downgrade' to yes
# The default apt repository for each major Agent version is specified in the following variables.
datadog_agent5_apt_repo: "deb https://apt.datadoghq.com/ stable main"
datadog_agent6_apt_repo: "deb https://apt.datadoghq.com/ stable 6"
datadog_agent7_apt_repo: "deb https://apt.datadoghq.com/ stable 7"

# repos where datadog-agent v5 packages are available
datadog_agent5_apt_repo: "deb https://apt.datadoghq.com stable main"
datadog_agent5_yum_repo: "https://yum.datadoghq.com/rpm/{{ ansible_userspace_architecture }}/"
datadog_agent5_zypper_repo: "https://yum.datadoghq.com/suse/rpm/{{ ansible_userspace_architecture }}"
# The default yum repository for each major Agent version is specified in the following variables.
datadog_agent5_yum_repo: "https://yum.datadoghq.com/rpm/{{ ansible_userspace_architecture }}"
datadog_agent6_yum_repo: "https://yum.datadoghq.com/stable/6/{{ ansible_userspace_architecture }}"
datadog_agent7_yum_repo: "https://yum.datadoghq.com/stable/7/{{ ansible_userspace_architecture }}"

### End of Beta-Agent6-only experimental attributes ###
########################################################################
# The default zypper repository for each major Agent version is specified in the following variables.
datadog_agent5_zypper_repo: "https://yum.datadoghq.com/suse/rpm/{{ ansible_userspace_architecture }}"
datadog_agent6_zypper_repo: "https://yum.datadoghq.com/suse/stable/6/{{ ansible_userspace_architecture }}"
datadog_agent7_zypper_repo: "https://yum.datadoghq.com/suse/stable/7/{{ ansible_userspace_architecture }}"
File renamed without changes.
File renamed without changes.
15 changes: 7 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
- include_tasks: parse-version.yml
when: datadog_agent_version | length > 0
run_once: true

- include_tasks: set-parse-version.yml

- include_tasks: pkg-debian.yml
when: ansible_os_family == "Debian"
Expand All @@ -16,13 +15,13 @@
when: ansible_os_family == "Windows"

- include_tasks: agent5-linux.yml
when: datadog_agent5 and ansible_os_family != "Windows"
when: datadog_agent_major_version|int == 5 and ansible_os_family != "Windows"

- include_tasks: agent6-linux.yml
when: not datadog_agent5 and ansible_os_family != "Windows"
- include_tasks: agent-linux.yml
when: datadog_agent_major_version|int > 5 and ansible_os_family != "Windows"

- include_tasks: agent6-win.yml
when: not datadog_agent5 and ansible_os_family == "Windows"
- include_tasks: agent-win.yml
when: datadog_agent_major_version|int > 5 and ansible_os_family == "Windows"

- include_tasks: integration.yml
when: datadog_integration is defined
Expand Down
13 changes: 12 additions & 1 deletion tasks/parse-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set_fact:
agent_version: "{{ datadog_agent_version | regex_search(regexp, '\\g<epoch>', '\\g<major>', '\\g<minor>', '\\g<bugfix>', '\\g<suffix>', '\\g<release>') }}"
vars:
regexp: '(?:(?P<epoch>[0-9]+):)?(?P<major>[0-9]+)\.(?P<minor>[0-9]+)\.(?P<bugfix>[0-9]+)(?P<suffix>[^-\s]+)?(?:-(?P<release>[0-9]+))?'
regexp: '(?:(?P<epoch>[0-9]+):)?(?P<major>[0-9]+)\.(?P<minor>[0-9]+)\.(?P<bugfix>[0-9]+)(?P<suffix>(?:~|-)[^0-9\s-]+[^-\s]*)?(?:-(?P<release>[0-9]+))?'

- name: Set version vars
set_fact:
Expand All @@ -24,6 +24,17 @@
datadog_release: "1"
when: datadog_release | length == 0

- name: Stop play if datadog_agent_version and datadog_agent_major_version are not compatible
fail:
msg: "The provided major version {{ datadog_agent_major_version }} is not compatible with the
version {{ datadog_major }} deduced from datadog_agent_version ({{ datadog_agent_version }}).
Aborting play."
when: datadog_agent_major_version | length > 0 and datadog_major != datadog_agent_major_version

- name: Set datadog_agent_major_version to deduced value from datadog_agent_version
set_fact:
datadog_agent_major_version: "{{ datadog_major }}"

- name: Set OS-specific versions
set_fact:
datadog_agent_debian_version: "{{ datadog_epoch }}:{{ datadog_major }}.{{ datadog_minor }}.{{ datadog_bugfix }}{{ datadog_suffix }}-{{ datadog_release }}"
Expand Down
Loading