geerlingguy / ansible-role-docker

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

Being able to set static version for `docker` package #360

Closed mhkarimi1383 closed 2 years ago

mhkarimi1383 commented 2 years ago

We need to set static version of docker for lots of reasons, if it's okay I will make a PR ;)

mhkarimi1383 commented 2 years ago

I have done some investigations, we can set that in package name followed by - for yum and for apt we use package name followed by =

since we set have our package name configured like below

docker_edition: 'ce'
docker_package: "docker-{{ docker_edition }}"
docker_package_state: present

I don't know if it's okay to overwrite it directly or making tasks more conditional to handle new variable for version

geerlingguy commented 2 years ago

You could just set docker_package to the exact package. Making it work with =/- so it works across multiple distros can be quite tricky, so for the limited number of users who do need to pin a version, I recommend they do that by overriding the package variable itself.

mhkarimi1383 commented 2 years ago

Thank you