2015-06-01 03:51:50 +02:00
|
|
|
---
|
|
|
|
- name: Ensure dependencies for building from source are installed (RedHat).
|
2018-09-29 21:41:26 +02:00
|
|
|
package:
|
|
|
|
name:
|
|
|
|
- autoconf
|
|
|
|
- automake
|
|
|
|
- libtool
|
|
|
|
- bison
|
|
|
|
- make
|
2020-08-04 00:58:49 +02:00
|
|
|
- re2c
|
|
|
|
- sqlite-devel
|
|
|
|
- oniguruma-devel
|
2018-09-29 21:41:26 +02:00
|
|
|
- curl-devel
|
|
|
|
- recode-devel
|
|
|
|
- aspell-devel
|
|
|
|
- libxml2-devel
|
|
|
|
- pkgconfig
|
|
|
|
- libmcrypt-devel
|
|
|
|
- t1lib-devel
|
|
|
|
- libXpm-devel
|
|
|
|
- libpng-devel
|
|
|
|
- libjpeg-turbo-devel
|
|
|
|
- bzip2-devel
|
|
|
|
- openssl-devel
|
|
|
|
- freetype-devel
|
|
|
|
- libicu-devel
|
|
|
|
- mariadb-devel
|
|
|
|
- gmp-devel
|
|
|
|
state: present
|
2015-06-01 03:51:50 +02:00
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
- name: Update apt cache (Debian).
|
|
|
|
apt: update_cache=yes cache_valid_time=86400
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
|
|
|
- name: Ensure dependencies for building from source are installed (Debian).
|
2018-09-29 21:41:26 +02:00
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- build-essential
|
|
|
|
- autoconf
|
|
|
|
- automake
|
|
|
|
- libtool
|
|
|
|
- bison
|
|
|
|
- pkg-config
|
|
|
|
- re2c
|
2020-08-05 00:35:03 +02:00
|
|
|
- libsqlite3-dev
|
|
|
|
- libonig-dev
|
2018-09-29 21:41:26 +02:00
|
|
|
- libxml2-dev
|
|
|
|
- libcurl4-openssl-dev
|
|
|
|
- libbz2-dev
|
|
|
|
- libjpeg-dev
|
|
|
|
- libpng-dev
|
|
|
|
- libxpm-dev
|
|
|
|
- libfreetype6-dev
|
|
|
|
- libgmp3-dev
|
|
|
|
- libmcrypt-dev
|
2020-08-05 00:35:03 +02:00
|
|
|
- libmariadbclient-dev
|
2018-09-29 21:41:26 +02:00
|
|
|
- libpspell-dev
|
|
|
|
- librecode-dev
|
|
|
|
- libssl-dev
|
|
|
|
state: present
|
2015-06-01 03:51:50 +02:00
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
2016-03-05 19:09:22 +01:00
|
|
|
- name: Define php_fpm_daemon (if not defined already).
|
|
|
|
set_fact:
|
|
|
|
php_fpm_daemon: "php-fpm"
|
|
|
|
when: php_fpm_daemon is not defined
|
|
|
|
|
2015-06-01 04:05:08 +02:00
|
|
|
- name: Check if gmp.h is already in a location accessible to gcc.
|
|
|
|
stat: path=/usr/include/gmp.h
|
|
|
|
register: gmp_file
|
|
|
|
|
2015-06-01 03:51:50 +02:00
|
|
|
- name: Ensure gmp.h is symlinked into a location accessible to gcc.
|
2020-08-21 05:34:18 +02:00
|
|
|
file: # noqa 208
|
2015-10-02 19:49:11 +02:00
|
|
|
src: "{{ php_source_install_gmp_path }}"
|
2015-06-01 03:51:50 +02:00
|
|
|
dest: /usr/include/gmp.h
|
|
|
|
state: link
|
2019-01-04 04:50:00 +01:00
|
|
|
when: not gmp_file.stat.exists
|
2015-06-01 03:51:50 +02:00
|
|
|
|
2015-06-01 05:22:36 +02:00
|
|
|
- name: Check if PHP is installed.
|
|
|
|
command: which php
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: php_installed
|
|
|
|
|
2015-06-01 03:51:50 +02:00
|
|
|
- name: Clone the PHP repository.
|
|
|
|
git:
|
2017-09-22 04:58:02 +02:00
|
|
|
repo: "{{ php_source_repo }}"
|
2015-06-01 03:51:50 +02:00
|
|
|
dest: "{{ php_source_clone_dir }}"
|
|
|
|
version: "{{ php_source_version }}"
|
2018-09-29 21:41:26 +02:00
|
|
|
accept_hostkey: true
|
2016-11-23 20:46:01 +01:00
|
|
|
depth: "{{ php_source_clone_depth }}"
|
2017-09-22 04:58:02 +02:00
|
|
|
when: php_installed.rc != 0
|
2015-06-01 03:51:50 +02:00
|
|
|
|
|
|
|
- name: Ensure PHP installation path exists.
|
|
|
|
file:
|
|
|
|
path: "{{ php_source_install_path }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
2017-09-22 04:58:02 +02:00
|
|
|
when: php_installed.rc != 0
|
2015-06-01 03:51:50 +02:00
|
|
|
|
|
|
|
- name: Build configure script.
|
2018-09-29 21:41:26 +02:00
|
|
|
command: >
|
2015-07-06 04:07:51 +02:00
|
|
|
./buildconf --force
|
2015-06-01 03:51:50 +02:00
|
|
|
chdir={{ php_source_clone_dir }}
|
2017-09-22 04:58:02 +02:00
|
|
|
when: php_installed.rc != 0
|
2015-06-01 03:51:50 +02:00
|
|
|
|
|
|
|
- name: Run configure script.
|
2018-09-29 21:41:26 +02:00
|
|
|
command: >
|
2015-06-01 03:51:50 +02:00
|
|
|
{{ php_source_configure_command }}
|
|
|
|
chdir={{ php_source_clone_dir }}
|
2017-09-22 04:58:02 +02:00
|
|
|
when: php_installed.rc != 0
|
2015-06-01 03:51:50 +02:00
|
|
|
|
|
|
|
- name: Make and install PHP.
|
2018-09-29 21:41:26 +02:00
|
|
|
command: >
|
2015-06-01 03:51:50 +02:00
|
|
|
{{ item }}
|
|
|
|
chdir={{ php_source_clone_dir }}
|
|
|
|
with_items:
|
|
|
|
- "{{ php_source_make_command }}"
|
|
|
|
- make install
|
2017-09-22 04:58:02 +02:00
|
|
|
when: php_installed.rc != 0
|
2015-06-01 03:51:50 +02:00
|
|
|
|
|
|
|
- name: Ensure php executable is symlinked into a standard path.
|
2020-08-21 05:34:18 +02:00
|
|
|
file: # noqa 208
|
2015-06-01 03:51:50 +02:00
|
|
|
src: "{{ php_source_install_path }}/bin/php"
|
|
|
|
dest: /usr/bin/php
|
|
|
|
state: link
|
2015-07-06 05:21:58 +02:00
|
|
|
|
2015-07-06 17:07:58 +02:00
|
|
|
# PHP FPM configuration.
|
2015-07-06 05:21:58 +02:00
|
|
|
- name: Ensure php-fpm executable is symlinked into a standard path.
|
2020-08-21 05:34:18 +02:00
|
|
|
file: # noqa 208
|
2015-07-06 05:21:58 +02:00
|
|
|
src: "{{ php_source_install_path }}/sbin/php-fpm"
|
|
|
|
dest: "/usr/sbin/{{ php_fpm_daemon }}"
|
2015-07-06 17:07:58 +02:00
|
|
|
state: link
|
|
|
|
when: "'--enable-fpm' in php_source_configure_command"
|
|
|
|
|
|
|
|
- name: Ensure php-fpm init script is installed.
|
|
|
|
template:
|
|
|
|
src: fpm-init.j2
|
|
|
|
dest: "/etc/init.d/{{ php_fpm_daemon }}"
|
|
|
|
mode: 0755
|
|
|
|
when: "'--enable-fpm' in php_source_configure_command"
|
|
|
|
notify: restart php-fpm
|
|
|
|
|
2015-07-07 02:46:04 +02:00
|
|
|
- name: Ensure php-fpm config directory exists.
|
|
|
|
file:
|
2016-03-04 03:24:26 +01:00
|
|
|
path: "{{ php_fpm_conf_path }}"
|
2015-07-07 02:46:04 +02:00
|
|
|
state: directory
|
2020-08-21 05:34:18 +02:00
|
|
|
mode: 0755
|
2015-07-07 02:46:04 +02:00
|
|
|
when: "'--enable-fpm' in php_source_configure_command"
|
|
|
|
|
2015-07-06 17:07:58 +02:00
|
|
|
- name: Ensure php-fpm config file is installed.
|
|
|
|
template:
|
|
|
|
src: php-fpm.conf.j2
|
2016-03-04 03:24:26 +01:00
|
|
|
dest: "{{ php_fpm_conf_path }}/php-fpm.conf"
|
2015-07-06 17:07:58 +02:00
|
|
|
mode: 0644
|
2015-07-06 05:21:58 +02:00
|
|
|
when: "'--enable-fpm' in php_source_configure_command"
|
2015-07-06 17:07:58 +02:00
|
|
|
notify: restart php-fpm
|