geerlingguy / ansible-role-docker

Ansible Role - Docker
https://galaxy.ansible.com/geerlingguy/docker/
MIT License
1.86k stars 861 forks source link

Role does not work with Fedora with only dnf5 installed #472

Open tiny-pangolin opened 1 month ago

tiny-pangolin commented 1 month ago

I receive the following output when I import this role on Fedora 40 with only dnf5. The role behaves correctly on Fedora 40 with dnf4 installed

PLAY [Docker Host] ***********************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************
ok: [kenny.local.shiftsystems.net]

TASK [Install Docker] ********************************************************************************************************************

TASK [geerlingguy.docker : Load OS-specific vars.] ***************************************************************************************
ok: [kenny.local.shiftsystems.net]

TASK [geerlingguy.docker : include_tasks] ************************************************************************************************
included: /home/mathias/.ansible/roles/geerlingguy.docker/tasks/setup-RedHat.yml for kenny.local.shiftsystems.net

TASK [geerlingguy.docker : Ensure old versions of Docker are not installed.] *************************************************************
fatal: [kenny.local.shiftsystems.net]: FAILED! => {"changed": false, "failures": ["No packages to remove for argument: docker-common", "No packages to remove for argument: docker-engine", "Problem: problem with installed package \n  - package docker-ce-3:27.3.1-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.0.0-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.0.1-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.0.2-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.1.0-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.1.1-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.1.2-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.1.3-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:26.1.4-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.0.1-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.0.2-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.0.3-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.1.0-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.1.1-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.1.2-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.2.0-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.2.1-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - package docker-ce-3:27.3.0-1.fc40.x86_64 requires docker-ce-cli, but none of the providers can be installed\n  - conflicting requests"], "msg": "Depsolve Error occurred", "rc": 1}

Running sudo dnf5 remove docker docker-common docker-engine executes correctly.

$ sudo dnf5 remove docker docker-common docker-engine
No packages to remove for argument: docker
No packages to remove for argument: docker-common
No packages to remove for argument: docker-engine

I believe this is the task where the failure occurs is Ensure old versions of Docker are not installed in this file tasks/setup-RedHat.yml

tiny-pangolin commented 1 month ago

I also noticed that the docker_obsolete_packages variable is not used for RedHat. Would it be possible to change the hard coded list to use this variable? Using the variable instead of the hard coded variable would allow me to work around the issue and make the behavior consistent between Debian and RedHat family distros.

cschindlbeck commented 2 weeks ago

This behavior has been adressed in https://github.com/ansible/ansible/pull/80550 but i think it is only included in 2.18

As for your second suggestion, yes, you can replace the hardcoded list, see here https://github.com/geerlingguy/ansible-role-docker/pull/474