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

Limit the versions of the agent that can be installed on Centos < 7 #556

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions tasks/pkg-redhat.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
---
- name: Set upper bound last supported Agent version for Centos < 7
when: ansible_facts.os_family == "RedHat"
block:
- name: Get RHEL major version equivalent
command: "rpm -E %{rhel}" # noqa: command-instead-of-module
register: rhel_version
changed_when: false
check_mode: false
- name: Set upper agent version bound as ansible fact
set_fact:
datadog_agent_max_minor_version: 51
when: rhel_version.stdout | int < 7

- name: Fail if specified agent version is above maximum supported by Centos < 7 and equivalent
fail:
msg: "Agent versions {{ agent_datadog_major }}.{{ datadog_agent_max_minor_version + 1 }} and above not supported by current OS (RHEL < 7 equivalent)."
when: datadog_agent_max_minor_version is defined and agent_datadog_minor is defined and agent_datadog_minor | int > datadog_agent_max_minor_version

- name: Fail early if Python 3 is used on CentOS / RHEL < 8 with old Ansible
fail:
msg: "The installation of the Agent on RedHat family systems using yum is not compatible with Python 3 with older Ansible versions.
Expand Down
13 changes: 11 additions & 2 deletions tasks/pkg-redhat/install-latest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
---
- name: Set installation target for latest
set_fact:
# Apply a version cap if required, otherwise just target the agent package
datadog_agent_target: >-
{{ datadog_agent_flavor }}
{% if datadog_agent_max_minor_version is defined %}
< 1:{{ agent_datadog_agent_major_version }}.{{ datadog_agent_max_minor_version + 1 }}.0-1
spencergilbert marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}

- name: Install latest datadog-agent package (dnf)
dnf:
name: "{{ datadog_agent_flavor }}"
name: "{{ datadog_agent_target }}"
update_cache: true
state: latest # noqa package-latest
register: agent_datadog_agent_install
Expand All @@ -10,7 +19,7 @@

- name: Install latest datadog-agent package (yum)
yum:
name: "{{ datadog_agent_flavor }}"
name: "{{ datadog_agent_target }}"
update_cache: true
state: latest # noqa package-latest
register: agent_datadog_agent_install
Expand Down