From 809394707981f10232e58cac6a607e2a5d016a5b Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 23 Oct 2018 13:50:02 -0500 Subject: [PATCH] Add new php_default_version_debian variable so 7.2 can be used on Bionic. --- README.md | 10 +++++++--- defaults/main.yml | 3 +++ vars/Debian.yml | 38 +++++++++++++++++++------------------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index adff28d..3922344 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,15 @@ The default values for the HTTP server deamon are `httpd` (used by Apache) for R (RedHat/CentOS only) If you have enabled any additional repositories (might I suggest [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi)), those repositories can be listed under this variable (e.g. `remi-php70,epel`). This can be handy, as an example, if you want to install the latest version of PHP 7.0, which is in the Remi repository. + php_default_version_debian: "7.0" + +(Debian/Ubuntu only) The default version of PHP in the given OS version repositories. Defaults to the latest Ubuntu LTS release. Ubuntu 18.04 needs this to be set to `"7.2"` since PHP 7.0 is not available in the default bionic packages. + +**If you'd like to be able to switch PHP versions easily, or use a version that's not available in system packages**: You can use the [`geerlingguy.php-versions`](https://galaxy.ansible.com/geerlingguy/php-versions/) role to more easily switch between major PHP versions (e.g. 5.6, 7.1, 7.2). + php_packages_state: "present" -If you have enabled any additional repositories such as [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to swap PHP versions on the fly. By default, this is set to `"present"`. You can override this variable to `"latest"` to upgrade to the latest available version. Combined with php_enablerepo`, a user now doesn't need to manually uninstall the existing PHP packages before installing them from a different repository. - -You can also use the [`geerlingguy.php-versions`](https://galaxy.ansible.com/geerlingguy/php-versions/) role to more easily switch between major PHP versions (e.g. 5.6, 7.0, 7.1, 7.2). +If you have enabled any additional repositories such as [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to swap PHP versions on the fly. By default, this is set to `"present"`. You can override this variable to `"latest"` to upgrade to the latest available version. Combined with `php_enablerepo`, a user now doesn't need to manually uninstall the existing PHP packages before installing them from a different repository. php_install_recommends: true diff --git a/defaults/main.yml b/defaults/main.yml index b2f42a2..8b04351 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,6 +3,9 @@ # for RHEL/CentOS. php_enablerepo: "" +# Default PHP version to install on Debian-based OSes. +php_default_version_debian: "7.0" + # PHP package state; use 'present' to make sure it's installed, or 'latest' if # you want to upgrade or switch versions using a new repo. php_packages_state: present diff --git a/vars/Debian.yml b/vars/Debian.yml index 2dba014..c5f90b5 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,36 +1,36 @@ --- __php_packages: - - php7.0-common - - php7.0-cli - - php7.0-dev - - php7.0-fpm + - php{{ php_default_version_debian }}-common + - php{{ php_default_version_debian }}-cli + - php{{ php_default_version_debian }}-dev + - php{{ php_default_version_debian }}-fpm - libpcre3-dev - - php7.0-gd - - php7.0-curl - - php7.0-imap - - php7.0-json - - php7.0-opcache - - php7.0-xml - - php7.0-mbstring + - php{{ php_default_version_debian }}-gd + - php{{ php_default_version_debian }}-curl + - php{{ php_default_version_debian }}-imap + - php{{ php_default_version_debian }}-json + - php{{ php_default_version_debian }}-opcache + - php{{ php_default_version_debian }}-xml + - php{{ php_default_version_debian }}-mbstring - php-sqlite3 - php-apcu __php_webserver_daemon: "apache2" # Vendor-specific configuration paths on Debian/Ubuntu make my brain asplode. __php_conf_paths: - - /etc/php/7.0/fpm - - /etc/php/7.0/apache2 - - /etc/php/7.0/cli + - /etc/php/{{ php_default_version_debian }}/fpm + - /etc/php/{{ php_default_version_debian }}/apache2 + - /etc/php/{{ php_default_version_debian }}/cli __php_extension_conf_paths: - - /etc/php/7.0/fpm/conf.d - - /etc/php/7.0/apache2/conf.d - - /etc/php/7.0/cli/conf.d + - /etc/php/{{ php_default_version_debian }}/fpm/conf.d + - /etc/php/{{ php_default_version_debian }}/apache2/conf.d + - /etc/php/{{ php_default_version_debian }}/cli/conf.d __php_apc_conf_filename: 20-apcu.ini __php_opcache_conf_filename: 10-opcache.ini -__php_fpm_daemon: php7.0-fpm -__php_fpm_conf_path: "/etc/php/7.0/fpm" +__php_fpm_daemon: php{{ php_default_version_debian }}-fpm +__php_fpm_conf_path: "/etc/php/{{ php_default_version_debian }}/fpm" __php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf" __php_fpm_pool_user: www-data