ansible-role-php/tasks/main.yml

60 lines
1.7 KiB
YAML

---
# Variable setup.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Define php_packages.
set_fact:
php_packages: "{{ __php_packages | list }}"
when: php_packages is not defined
- name: Define php_webserver_daemon.
set_fact:
php_webserver_daemon: "{{ __php_webserver_daemon }}"
when: php_webserver_daemon is not defined
- name: Define php_conf_path.
set_fact:
php_conf_path: "{{ __php_conf_path }}"
when: php_conf_path is not defined
- name: Define php_extension_conf_path.
set_fact:
php_extension_conf_path: "{{ __php_extension_conf_path }}"
when: php_extension_conf_path is not defined
- name: Define php_apc_conf_filename.
set_fact:
php_apc_conf_filename: "{{ __php_apc_conf_filename }}"
when: php_apc_conf_filename is not defined
- name: Define php_opcache_conf_filename.
set_fact:
php_opcache_conf_filename: "{{ __php_opcache_conf_filename }}"
when: php_opcache_conf_filename is not defined
# Setup/install tasks.
- include: setup-RedHat.yml
when: (php_install_from_source == false) and (ansible_os_family == 'RedHat')
- include: setup-Debian.yml
when: (php_install_from_source == false) and (ansible_os_family == 'Debian')
# Install PHP from source when php_install_from_source is true.
- include: install-from-source.yml
when: php_install_from_source == true
- name: Check the installed version of PHP.
shell: '{{ php_executable }} -r "echo PHP_VERSION;"'
register: php_version
changed_when: false
always_run: yes
- name: Disable opcache if PHP version is < 5.5.
set_fact:
php_opcache_enable: 0
when: "php_version.stdout.split('.')[0] == '5' and php_version.stdout.split('.')[1] < '5'"
# Configure PHP.
- include: configure.yml