Merge pull request #352 from crate-workbench/amo/allow-downgrades-debian-redhat-only

Fix package downgrading for non-{RedHat,Debian} systems
This commit is contained in:
Jeff Geerling 2022-05-24 23:23:22 -05:00 committed by GitHub
commit 2bc23db51a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,22 +5,22 @@
- include_tasks: setup-Debian.yml - include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
- name: Install Docker (Ansible <2.12). - name: Install Docker.
package: package:
name: "{{ docker_package }}" name: "{{ docker_package }}"
state: "{{ docker_package_state }}" state: "{{ docker_package_state }}"
notify: restart docker notify: restart docker
ignore_errors: "{{ ansible_check_mode }}" ignore_errors: "{{ ansible_check_mode }}"
when: "ansible_version.full is version_compare('2.12', '<')" when: "ansible_version.full is version_compare('2.12', '<') or ansible_os_family not in ['RedHat', 'Debian']"
- name: Install Docker (Ansible >=2.12). - name: Install Docker (with downgrade option).
package: package:
name: "{{ docker_package }}" name: "{{ docker_package }}"
state: "{{ docker_package_state }}" state: "{{ docker_package_state }}"
allow_downgrade: true allow_downgrade: true
notify: restart docker notify: restart docker
ignore_errors: "{{ ansible_check_mode }}" ignore_errors: "{{ ansible_check_mode }}"
when: "ansible_version.full is version_compare('2.12', '>=')" when: "ansible_version.full is version_compare('2.12', '>=') and ansible_os_family in ['RedHat', 'Debian']"
- name: Ensure /etc/docker/ directory exists. - name: Ensure /etc/docker/ directory exists.
file: file: