Skip to content

Commit

Permalink
Fix downgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvaka committed Nov 27, 2020
1 parent 2ddfddb commit 8a8039a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tasks/pkg-redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
enabled: yes
gpgcheck: yes
gpgkey: "{{ datadog_yum_gpgkey }}"
register: repofile5
when: (datadog_agent_major_version|int == 5) and (datadog_yum_repo | length == 0) and (not ansible_check_mode)

- name: Install Datadog Agent 6 yum repo
Expand All @@ -41,6 +42,7 @@
enabled: yes
gpgcheck: yes
gpgkey: "{{ datadog_yum_gpgkey }}"
register: repofile6
when: (datadog_agent_major_version|int == 6) and (datadog_yum_repo | length == 0) and (not ansible_check_mode)

- name: Install Datadog Agent 7 yum repo
Expand All @@ -51,6 +53,7 @@
enabled: yes
gpgcheck: yes
gpgkey: "{{ datadog_yum_gpgkey_20200908 }}"
register: repofile7
when: (datadog_agent_major_version|int == 7) and (datadog_yum_repo | length == 0) and (not ansible_check_mode)

- name: Install Datadog Custom yum repo
Expand All @@ -61,8 +64,16 @@
enabled: yes
gpgcheck: yes
gpgkey: "{{ datadog_yum_gpgkey }}"
register: repofilecustom
when: (datadog_yum_repo | length > 0) and (not ansible_check_mode)

- name: Clean repo metadata if repo changed
command: yum clean metadata --disablerepo="*" --enablerepo=datadog
ignore_errors: yes # Cleaning the metadata is only needed when downgrading a major version of the Agent, don't fail because of this
args:
warn: no
when: repofile5.changed or repofile6.changed or repofile7.changed or repofilecustom.changed

- name: Remove old yum repo files
yum_repository:
name: "ansible_datadog_{{ item }}.repo"
Expand Down

0 comments on commit 8a8039a

Please sign in to comment.