Skip to content

Commit

Permalink
Fix idempotency errors
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak committed Nov 3, 2023
1 parent a898236 commit 505b0f0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@
ansible.builtin.package_facts:
manager: auto

- name: Remove package locks
- name: Disable package locks
when: heartbeat_package_hold
block:

- name: Remove yum package lock
- name: Disable yum package lock
when: ansible_os_family == 'RedHat'
block:

- name: Install yum version lock support
ansible.builtin.package:
name: yum-plugin-versionlock

- name: Configure yum versionlock
- name: Disable yum package lock
community.general.yum_versionlock:
name: "{{ item }}"
state: absent
loop: "{{ [heartbeat_package_names] | flatten }}"
changed_when: false
when: item in packages
tags: skip_ansible_lint

- name: Disable apt package lock
ansible.builtin.dpkg_selections:
name: "{{ item }}"
selection: install
loop: "{{ [heartbeat_package_names] | flatten }}"
changed_when: false
when:
- item in packages
- ansible_os_family == 'Debian'
Expand All @@ -41,7 +42,7 @@
when: heartbeat_package_state in ['present', 'latest']
block:

- name: Enable package holds
- name: Enable package locks
when: heartbeat_package_hold
block:

Expand All @@ -50,15 +51,16 @@
name: "{{ item }}"
selection: hold
loop: "{{ [heartbeat_package_names] | flatten }}"
changed_when: false
when: (ansible_os_family | lower) == 'debian'

- name: Enable yum package lock
community.general.yum_versionlock:
name: "{{ item }}"
state: present
loop: "{{ [heartbeat_package_names] | flatten }}"
changed_when: false
when: ansible_os_family == 'RedHat'
tags: skip_ansible_lint

- name: Configure heartbeat
ansible.builtin.copy:
Expand Down

0 comments on commit 505b0f0

Please sign in to comment.