ansible-role-php-versions/tasks/setup-RedHat.yml

46 lines
1.3 KiB
YAML

---
# TODO: PHP 7.2 support will be removed soon. This is only being left in here as
# a convenience for legacy PHP 7.2 users.
- name: Enable remi repo for PHP 7.2.
set_fact: php_enablerepo="remi,remi-php72"
when: php_version == "7.2"
- name: Enable remi repo for PHP 7.3.
set_fact: php_enablerepo="remi,remi-php73"
when: php_version == "7.3"
- name: Enable remi repo for PHP 7.4.
set_fact: php_enablerepo="remi,remi-php74"
when: php_version == "7.4"
- name: Enable remi repo for PHP 8.0.
set_fact: php_enablerepo="remi,remi-php80"
when: php_version == "8.0"
- name: Enable remi repo for PHP 8.1.
set_fact: php_enablerepo="remi,remi-php81"
when: php_version == "8.1"
- name: Enable remi repo for PHP 8.2.
set_fact: php_enablerepo="remi,remi-php82"
when: php_version == "8.2"
# See: https://github.com/ansible/ansible/issues/64852
- block:
- name: Ensure dnf-plugins are installed on CentOS 8+.
yum:
name: dnf-plugins-core
state: present
- name: Enable DNF module for CentOS 8+.
shell: |
dnf config-manager --set-enabled powertools
dnf module enable -y php:remi-{{ php_version }}
register: dnf_module_enable
changed_when: "'Nothing to do' not in dnf_module_enable.stdout"
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version | int >= 8