Skip to content

Commit

Permalink
Support Agent v6 on yum-based platforms
Browse files Browse the repository at this point in the history
 - Add the DataDog yum beta repo
 - Fix some places where we don't update or restart the agent
 - Create /etc/datadog
  • Loading branch information
brendanlong authored and hush-hush committed Jan 8, 2018
1 parent bc66f14 commit 380b44c
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ install:
- pip install ansible-lint

script:
- ansible-lint -v $(find tests -name *yml) -x ANSIBLE0010
- ansible-lint -v $(find tests -name *yml) -x ANSIBLE0006,ANSIBLE0010
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

# 1.5.0 / 2018-01-05

* [FEATURE] Add Agent6 (beta) support on RPM-based distros. See [#90][] (thanks [@brendanlong][])

# 1.4.0 / 2017-10-30

* [FEATURE] Allow specifying custom repo. See [#80][]
Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ datadog_agent_allow_downgrade: no
# * set 'datadog_agent_allow_downgrade' to yes
datadog_agent6: no

# beta APT repo where datadog-agent v6 packages are available
# beta repos where datadog-agent v6 packages are available
datadog_agent6_apt_repo: "deb http://apt.datadoghq.com beta main"
datadog_agent6_yum_repo: "https://yum.datadoghq.com/beta/{{ ansible_userspace_architecture }}/"

### End of Beta-Agent6-only experimental attributes ###
########################################################################
Expand Down
7 changes: 6 additions & 1 deletion tasks/agent6.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
- name: Create main Datadog agent yaml configuration file (beta)
- name: Create /etc/datadog-agent
file:
dest: /etc/datadog-agent
state: directory

- name: Create main Datadog agant yaml configuration file (beta)
template:
src: datadog.yaml.j2
dest: /etc/datadog-agent/datadog.yaml
Expand Down
29 changes: 24 additions & 5 deletions tasks/pkg-redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,36 @@
- name: Import new RPM key
rpm_key: key=/tmp/DATADOG_RPM_KEY_E09422B3.public state=present

- name: Copy repo file into place
template: src=datadog.repo.j2 dest=/etc/yum.repos.d/datadog.repo owner=root group=root mode=0644
- name: Install DataDog yum repo
yum_repository:
name: datadog
description: Datadog, Inc.
baseurl: "{{ datadog_yum_repo }}"
enabled: yes
gpgcheck: yes
gpgkey: "{{ datadog_yum_gpgkey }}"
state: "{% if datadog_agent6 %}absent{% else %}present{% endif %}"

- name: Install DataDog yum repo (beta)
yum_repository:
name: datadog-beta
description: Datadog, Inc.
baseurl: "{{ datadog_agent6_yum_repo }}"
enabled: yes
gpgcheck: yes
gpgkey: "{{ datadog_yum_gpgkey }}"
state: "{% if datadog_agent6 %}present{% else %}absent{% endif %}"

- name: Install pinned datadog-agent package
yum:
name: datadog-agent-{{ datadog_agent_version }}
state: present
when: datadog_agent_version != ""
notify: restart datadog-agent

# Using `yum` directly to work around an Ansible bug:
# https://github.com/ansible/ansible/issues/20608
- name: Install latest datadog-agent package
yum:
name: datadog-agent
state: latest
command: yum install -y datadog-agent
when: datadog_agent_version == ""
notify: restart datadog-agent
6 changes: 0 additions & 6 deletions templates/datadog.repo.j2

This file was deleted.

0 comments on commit 380b44c

Please sign in to comment.