geerlingguy / ansible-role-php-versions

Ansible Role - PHP Versions
https://galaxy.ansible.com/geerlingguy/php-versions/
MIT License
98 stars 73 forks source link

Ability to install specific versions of PHP #6

Closed walterdolce closed 7 years ago

walterdolce commented 7 years ago

Hi,

I just tried this role for the first time and I tried to pin the PHP version to install to 7.1.5 but it looks like the role is unable to install specific versions of PHP.

Trying to do the above produced the following error for me:

No package matching 'php7.1.5' is available

Is this expected?

I was going under the assumption it was able to install a specific version of PHP because one might not want to use 7.1 and have the potential of jumping from 7.1.5 to 7.1.6 without being aware of it (not to mention the potential breaking changes/bugs which might be introduced).

geerlingguy commented 7 years ago

@walterdolce - The purpose of this particular role is to allow easy switching between major versions of PHP (e.g. use 7.1.x stable, or 7.0.x stable); if you need a specific release to be locked in, my best advice would be to not use this role, but to build PHP from source (e.g. the way drupal-pi does it).

Otherwise you could get that working with this role by using php_packages_state: present—what this does is install whatever is the latest stable version, but then during future runs, since it's already installed, it won't change/upgrade.

But you could change it to php_packages_state: latest to always make sure the PHP packages are upgraded to the latest stable releases whenever the playbook is run.

walterdolce commented 7 years ago

Otherwise you could get that working with this role by using php_packages_state: present—what this does is install whatever is the latest stable version

That is my point. To avoid the "whatever is the latest stable version" bit. But I guess that building it from source should do it. Thank you.

geerlingguy commented 7 years ago

Yeah, in that case the best solution is to build from source (or go further and set up your own apt/yum/dnf repository and build versions there, then install from that repo... but that's only helpful in cases where you need more reproducible version deployments across multiple/many servers).