Skip to content
Snippets Groups Projects
Commit 87b3b368 authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-playbooks/general#85 Linting

parent f0081b5b
No related branches found
No related tags found
No related merge requests found
php_version: '7.0'
php_version_main: '7'
php_version: 7.0
php_version_main: 7
php_fpm: true
php_fpm_socket: false
......@@ -26,93 +26,93 @@ php_packages:
- php5-xmlrpc
- imagemagick
php_base_dir: 'php5'
php_conf_dir: 'conf.d'
php_base_dir: php5
php_conf_dir: conf.d
php_imagick_config_dir: '/etc/ImageMagick-6'
php_allow_call_time_pass_reference: 'on'
php_imagick_config_dir: /etc/ImageMagick-6
php_allow_call_time_pass_reference: on
php_browscap: false
php_date_timezone: 'Europe/Berlin'
php_display_errors: 'Off'
php_display_startup_errors: 'Off'
php_error_reporting: 'E_ALL & ~E_NOTICE'
php_expose_php: 'Off'
php_filter_default: 'unsafe_raw'
php_html_errors: 'Off'
php_log_errors: 'On'
php_magic_quotes_gpc: 'On'
php_max_execution_time: '30'
php_max_file_uploads: '20'
php_max_input_time: '60'
php_max_input_vars: '1000'
php_memory_limit: '32M'
php_date_timezone: Europe/Berlin
php_display_errors: Off
php_display_startup_errors: Off
php_error_reporting: E_ALL & ~E_NOTICE
php_expose_php: Off
php_filter_default: unsafe_raw
php_html_errors: Off
php_log_errors: On
php_magic_quotes_gpc: On
php_max_execution_time: 30
php_max_file_uploads: 20
php_max_input_time: 60
php_max_input_vars: 1000
php_memory_limit: 32M
php_needs_msodbc: false
php_needs_oci8: false
php_output_buffering: '4096'
php_post_max_size: '32M'
php_register_globals: 'Off'
php_register_long_arrays: 'On'
php_sendmail_path: '/usr/sbin/sendmail -t -i'
php_session_cache_expire: '180'
php_session_cookie_lifetime: '0'
php_session_gc_divisor: '1000'
php_session_gc_maxlifetime: '1440'
php_short_open_tag: 'Off'
php_upload_max_filesize: '2M'
php_zend_assertions: '-1'
php_output_buffering: 4096
php_post_max_size: 32M
php_register_globals: Off
php_register_long_arrays: On
php_sendmail_path: /usr/sbin/sendmail -t -i
php_session_cache_expire: 180
php_session_cookie_lifetime: 0
php_session_gc_divisor: 1000
php_session_gc_maxlifetime: 1440
php_short_open_tag: Off
php_upload_max_filesize: 2M
php_zend_assertions: -1
# PHP FPM
php_fpm_max_children: '10'
php_fpm_start_servers: '4'
php_fpm_min_spare_servers: '2'
php_fpm_max_spare_servers: '6'
php_fpm_max_requests: '2000'
php_fpm_max_children: 10
php_fpm_start_servers: 4
php_fpm_min_spare_servers: 2
php_fpm_max_spare_servers: 6
php_fpm_max_requests: 2000
# apc.ini
apc_rfc1867: '1'
apc_shm_size: '256M'
apc_shm_segments: '1'
apc_num_files_hint: '0'
apc_ttl: '7200'
apc_user_ttl: '7200'
apc_gc_ttl: '3600'
apc_rfc1867: 1
apc_shm_size: 256M
apc_shm_segments: 1
apc_num_files_hint: 0
apc_ttl: 7200
apc_user_ttl: 7200
apc_gc_ttl: 3600
# opcache.ini
opcache_memory_consumption: '128'
opcache_max_accelerated_files: '7963'
opcache_revalidate_freq: '30'
opcache_interned_strings_buffer: '16'
opcache_memory_consumption: 128
opcache_max_accelerated_files: 7963
opcache_revalidate_freq: 30
opcache_interned_strings_buffer: 16
# php 5.3
php53:
libraries:
- file: 'libgd.so.2.0.0'
link: 'libgd.so.2'
- file: 'liblcms.so.1.0.19'
link: 'liblcms.so.1'
- file: 'libMagickCore.so.4.0.1'
link: 'libMagickCore.so.4'
- file: 'libMagickWand.so.4.0.1'
link: 'libMagickWand.so.4'
- file: 'libt1.so.5.1.2'
link: 'libt1.so.5'
- file: libgd.so.2.0.0
link: libgd.so.2
- file: liblcms.so.1.0.19
link: liblcms.so.1
- file: libMagickCore.so.4.0.1
link: libMagickCore.so.4
- file: libMagickWand.so.4.0.1
link: libMagickWand.so.4
- file: libt1.so.5.1.2
link: libt1.so.5
liblinks:
- src: '/lib/x86_64-linux-gnu/libpng12.so.0'
link: 'libpng12.so.0'
- src: /lib/x86_64-linux-gnu/libpng12.so.0
link: libpng12.so.0
modules:
- 'apc'
- 'curl'
- 'gd'
- 'imagick'
- 'imap'
#- 'json'
- 'mcrypt'
#- 'memcached'
- 'mysql'
- 'mysqli'
- 'pdo_mysql'
#- 'readline'
- 'redis'
- 'xmlrpc'
extdir: '/usr/local/lib/php/extensions/no-debug-non-zts-20090626'
libdir: '/usr/lib/x86_64-linux-gnu'
- apc
- curl
- gd
- imagick
- imap
#- json
- mcrypt
#- memcached
- mysql
- mysqli
- pdo_mysql
#- readline
- redis
- xmlrpc
extdir: /usr/local/lib/php/extensions/no-debug-non-zts-20090626
libdir: /usr/lib/x86_64-linux-gnu
......@@ -61,7 +61,7 @@ function defaults($d,$v) {
// rewrite $PHP_SELF to block XSS attacks
//
$PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],''), ENT_QUOTES, 'UTF-8') : '';
$PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],''), ENT_QUOTES, 'UTF-8') : ;
$time = time();
$host = php_uname('n');
if($host) { $host = '('.$host.')'; }
......@@ -452,7 +452,7 @@ function sortheader($key,$name,$extra='') {
global $MYREQUEST, $MY_SELF_WO_SORT;
if ($MYREQUEST['SORT1']==$key) {
$MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' ? 'D' : 'A';
$MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' ? 'D' : A;
}
return "<a class=sortable href=\"$MY_SELF_WO_SORT$extra&SORT1=$key&SORT2=".$MYREQUEST['SORT2']."\">$name</a>";
......@@ -837,11 +837,11 @@ EOB;
: "",
'<tr>',
'<td class=td-0><span class="green box">&nbsp;</span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n",
'<td class=td-1><span class="green box">&nbsp;</span>Hits: ',$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n",
'<td class=td-1><span class="green box">&nbsp;</span>Hits: ,$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses])),"</td>\n",
'</tr>',
'<tr>',
'<td class=td-0><span class="red box">&nbsp;</span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n",
'<td class=td-1><span class="red box">&nbsp;</span>Misses: ',$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n";
'<td class=td-1><span class="red box">&nbsp;</span>Misses: ,$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses])),"</td>\n";
echo <<< EOB
</tr>
</tbody></table>
......
---
# file: roles/php/handlers/main.yml
- name: "Restart PHP-FPM"
- name: Restart PHP-FPM
service:
name: '{{ phpFpmService }}'
state: 'restarted'
state: restarted
......@@ -5,29 +5,34 @@
---
# file: roles/php/tasks/main.yml
- name: "PHP Role"
set_fact: role_php_started=true
tags: 'always'
- name: PHP Role
set_fact:
role_php_started: yes
tags:
- always
- block:
- include_tasks: 'variables.yml'
tags: 'always'
- include_tasks: variables.yml
tags:
- always
- import_tasks: php.yml
- name: "Link PhpEnMod for PHP 5.3"
- name: Link PhpEnMod for PHP 5.3
file:
dest: '/usr/local/bin/php{{ item }}'
src: '/usr/sbin/php5{{ item }}'
state: 'link'
dest: /usr/local/bin/php{{ item }}
src: /usr/sbin/php5{{ item }}
state: link
with_items:
- 'enmod'
- 'dismod'
- enmod
- dismod
when: php_version|default("5.5") == "5.3"
- name: 'PHP | Remember that this role had been run'
set_fact: role_php_completed=true
tags: 'always'
- name: PHP | Remember that this role had been run
set_fact:
role_php_completed: yes
tags:
- always
when: '"php" not in excluded_roles and role_php_completed is not defined'
when: not excluded_roles or "php" not in excluded_roles and role_php_completed is not defined
---
# file: roles/php/tasks/msodbc.yml
- name: "Apt Key"
- name: Apt Key
apt_key:
url: 'https://packages.microsoft.com/keys/microsoft.asc'
state: 'present'
url: https://packages.microsoft.com/keys/microsoft.asc
state: present
- name: "Apt Repository"
- name: Apt Repository
apt_repository:
repo: 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod {{ ansible_distribution_release }} main'
state: 'present'
mode: '644'
repo: deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod {{ ansible_distribution_release }} main
state: present
mode: 644
- name: "Accept licenses"
- name: Accept licenses
debconf:
name: "{{ item }}-installer"
question: "{{ item }}/accept_eula"
value: "true"
vtype: "select"
with_items:
- 'msodbcsql'
- 'mssql-tools'
- msodbcsql
- mssql-tools
- name: "Install Packages"
- name: Install Packages
apt:
pkg: '{{ packages }}'
state: 'present'
state: present
update_cache: yes
vars:
packages:
- 'msodbcsql'
- 'mssql-tools'
- 'unixodbc-dev'
- msodbcsql
- mssql-tools
- unixodbc-dev
notify:
- "Apache | Restart Apache"
- name: "PHP | Install PECL packages"
shell: 'pecl install --soft {{ item }}'
- name: PHP | Install PECL packages
shell: pecl install --soft {{ item }}
with_items:
- 'sqlsrv'
- 'pdo_sqlsrv'
- sqlsrv
- pdo_sqlsrv
- name: "Configuration files"
- name: Configuration files
copy:
content: 'extension={{ item }}.so'
dest: '/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini'
owner: 'root'
group: 'root'
mode: '644'
content: extension={{ item }}.so
dest: /etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini
owner: root
group: root
mode: 644
with_items:
- 'sqlsrv'
- 'pdo_sqlsrv'
- sqlsrv
- pdo_sqlsrv
notify:
- "Apache | Restart Apache"
- name: "Enable extensions"
shell: 'phpenmod {{ item }}'
- name: Enable extensions
shell: phpenmod {{ item }}
with_items:
- 'sqlsrv'
- 'pdo_sqlsrv'
- sqlsrv
- pdo_sqlsrv
notify:
- "Apache | Restart Apache"
......@@ -5,87 +5,87 @@
# Better:
# @see PDO_OCI Install: https://drupal.org/comment/5572626#comment-5572626
- name: "PHP | Check OCI Requirement"
- name: PHP | Check OCI Requirement
stat:
path: '/usr/lib/php5/20090626/pdo_oci.so'
path: /usr/lib/php5/20090626/pdo_oci.so
register: oci_file
- block:
- name: "PHP | OCI | Enable OCI for PHP"
- name: PHP | OCI | Enable OCI for PHP
copy:
content: 'extension={{ item }}.so'
dest: '/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini'
owner: 'root'
group: 'root'
mode: '644'
content: extension={{ item }}.so
dest: /etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini
owner: root
group: root
mode: 644
with_items:
- 'oci8'
- 'pdo_oci'
- oci8
- pdo_oci
- name: "PHP | OCI | Remove possible components in /tmp"
- name: PHP | OCI | Remove possible components in /tmp
file:
path: '/tmp/{{ item }}'
state: 'absent'
path: /tmp/{{ item }}
state: absent
with_items:
- 'instantclient_11_2'
- 'oracle_x64_11_2_0_3_0_oci8_so'
- 'oracle_x64_11_2_0_3_0_pdo_oci_so'
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so
- oracle_x64_11_2_0_3_0_pdo_oci_so
- name: "PHP | OCI | Make available Oracle InstantClient"
- name: PHP | OCI | Make available Oracle InstantClient
command: scp -r {{ repository }}{{ item }} /tmp/
become: no
with_items:
- 'instantclient_11_2'
- 'oracle_x64_11_2_0_3_0_oci8_so'
- 'oracle_x64_11_2_0_3_0_pdo_oci_so'
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so
- oracle_x64_11_2_0_3_0_pdo_oci_so
- name: "PHP | OCI | Remove /usr/local/lib/instantclient_11_2"
- name: PHP | OCI | Remove /usr/local/lib/instantclient_11_2
file:
path: '/usr/local/lib/instantclient_11_2'
state: 'absent'
path: /usr/local/lib/instantclient_11_2
state: absent
- name: "PHP | OCI | Move Oracle InstantClient to /usr/local/lib"
- name: PHP | OCI | Move Oracle InstantClient to /usr/local/lib
command: mv /tmp/instantclient_11_2 /usr/local/lib/
- name: "PHP | OCI | Move oci8 to /usr/lib/php5"
- name: PHP | OCI | Move oci8 to /usr/lib/php5
command: mv /tmp/oracle_x64_11_2_0_3_0_oci8_so /usr/lib/php5/20090626/oci8.so
- name: "PHP | OCI | Move pdo_oci to /usr/lib/php5"
- name: PHP | OCI | Move pdo_oci to /usr/lib/php5
command: mv /tmp/oracle_x64_11_2_0_3_0_pdo_oci_so /usr/lib/php5/20090626/pdo_oci.so
- name: "PHP | OCI | Change ownership for Oracle InstantClient"
- name: PHP | OCI | Change ownership for Oracle InstantClient
file:
path: '{{ item }}'
owner: 'root'
group: 'root'
owner: root
group: root
recurse: yes
follow: no
with_items:
- '/usr/local/lib/instantclient_11_2'
- /usr/local/lib/instantclient_11_2
- name: "Ensure log directories"
- name: Ensure log directories
file:
path: '/usr/local/lib/instantclient_11_2/log/diag/clients'
owner: 'www-data'
group: 'root'
state: 'directory'
mode: '775'
path: /usr/local/lib/instantclient_11_2/log/diag/clients
owner: www-data
group: root
state: directory
mode: 775
follow: no
- name: "Set permissions in log directories"
- name: Set permissions in log directories
file:
path: '/usr/local/lib/instantclient_11_2/log'
owner: 'www-data'
group: 'root'
mode: '775'
path: /usr/local/lib/instantclient_11_2/log
owner: www-data
group: root
mode: 775
recurse: yes
follow: no
- name: "PHP | OCI | Make available libclntsh.so"
- name: PHP | OCI | Make available libclntsh.so
file:
src: '/usr/local/lib/instantclient_11_2/libclntsh.so.11.1'
dest: '/usr/local/lib/instantclient_11_2/libclntsh.so'
state: 'link'
src: /usr/local/lib/instantclient_11_2/libclntsh.so.11.1
dest: /usr/local/lib/instantclient_11_2/libclntsh.so
state: link
when: not oci_file.stat.exists
---
# file: roles/php/tasks/oci-5.6.yml
- name: "Check OCI Requirement"
- name: Check OCI Requirement
stat:
path: '/usr/lib/php/20131226/oci8.so'
path: /usr/lib/php/20131226/oci8.so
register: oci_file
- block:
- name: "Enable OCI for PHP"
- name: Enable OCI for PHP
copy:
content: 'extension={{ item }}.so'
dest: '/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini'
owner: 'root'
group: 'root'
mode: '644'
content: extension={{ item }}.so
dest: /etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini
owner: root
group: root
mode: 644
with_items:
- 'oci8'
- oci8
- name: "Remove possible components in /tmp"
- name: Remove possible components in /tmp
file:
path: '/tmp/{{ item }}'
state: 'absent'
path: /tmp/{{ item }}
state: absent
with_items:
- 'instantclient_11_2'
- 'oracle_x64_11_2_0_3_0_oci8_so_php_5_6'
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_5_6
- name: "Make available Oracle InstantClient"
- name: Make available Oracle InstantClient
command: scp -r {{ repository }}{{ item }} /tmp/
become: no
with_items:
- 'instantclient_11_2'
- 'oracle_x64_11_2_0_3_0_oci8_so_php_5_6'
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_5_6
- name: "Remove /usr/local/lib/instantclient_11_2"
- name: Remove /usr/local/lib/instantclient_11_2
file:
path: '/usr/local/lib/instantclient_11_2'
state: 'absent'
path: /usr/local/lib/instantclient_11_2
state: absent
- name: "Move Oracle InstantClient to /usr/local/lib"
- name: Move Oracle InstantClient to /usr/local/lib
command: mv /tmp/instantclient_11_2 /usr/local/lib/
- name: "Move oci8 to /usr/lib/php"
- name: Move oci8 to /usr/lib/php
command: mv /tmp/oracle_x64_11_2_0_3_0_oci8_so_php_4_5 /usr/lib/php/20131226/oci8.so
- name: "Change ownership for Oracle InstantClient"
- name: Change ownership for Oracle InstantClient
file:
path: '{{ item }}'
owner: 'root'
group: 'root'
owner: root
group: root
recurse: yes
follow: no
with_items:
- '/usr/local/lib/instantclient_11_2'
- /usr/local/lib/instantclient_11_2
- name: "Ensure log directories"
- name: Ensure log directories
file:
path: '/usr/local/lib/instantclient_11_2/log/diag/clients'
owner: 'www-data'
group: 'root'
state: 'directory'
mode: '775'
path: /usr/local/lib/instantclient_11_2/log/diag/clients
owner: www-data
group: root
state: directory
mode: 775
follow: no
- name: "Set permissions in log directories"
- name: Set permissions in log directories
file:
path: '/usr/local/lib/instantclient_11_2/log'
owner: 'www-data'
group: 'root'
mode: '775'
path: /usr/local/lib/instantclient_11_2/log
owner: www-data
group: root
mode: 775
recurse: yes
follow: no
- name: "Make available libclntsh.so"
- name: Make available libclntsh.so
file:
src: '/usr/local/lib/instantclient_11_2/libclntsh.so.11.1'
dest: '/usr/local/lib/instantclient_11_2/libclntsh.so'
state: 'link'
src: /usr/local/lib/instantclient_11_2/libclntsh.so.11.1
dest: /usr/local/lib/instantclient_11_2/libclntsh.so
state: link
when: not oci_file.stat.exists
---
# file: roles/php/tasks/oci-7.yml
- name: "Check OCI Requirement"
- name: Check OCI Requirement
stat:
path: '/usr/lib/php/20151012/oci8.so'
path: /usr/lib/php/20151012/oci8.so
register: oci_file
- block:
- name: "Enable OCI for PHP"
- name: Enable OCI for PHP
copy:
content: 'extension={{ item }}.so'
dest: '/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini'
owner: 'root'
group: 'root'
mode: '644'
content: extension={{ item }}.so
dest: /etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini
owner: root
group: root
mode: 644
with_items:
- 'oci8'
- oci8
- name: "Remove possible components in /tmp"
- name: Remove possible components in /tmp
file:
path: '/tmp/{{ item }}'
state: 'absent'
path: /tmp/{{ item }}
state: absent
with_items:
- 'instantclient_11_2'
- 'oracle_x64_11_2_0_3_0_oci8_so_php_7'
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_7
- name: "Make available Oracle InstantClient"
- name: Make available Oracle InstantClient
command: scp -r {{ repository }}{{ item }} /tmp/
become: no
with_items:
- 'instantclient_11_2'
- 'oracle_x64_11_2_0_3_0_oci8_so_php_7'
- instantclient_11_2
- oracle_x64_11_2_0_3_0_oci8_so_php_7
- name: "Remove /usr/local/lib/instantclient_11_2"
- name: Remove /usr/local/lib/instantclient_11_2
file:
path: '/usr/local/lib/instantclient_11_2'
state: 'absent'
path: /usr/local/lib/instantclient_11_2
state: absent
- name: "Move Oracle InstantClient to /usr/local/lib"
- name: Move Oracle InstantClient to /usr/local/lib
command: mv /tmp/instantclient_11_2 /usr/local/lib/
- name: "Move oci8 to /usr/lib/php"
- name: Move oci8 to /usr/lib/php
command: mv /tmp/oracle_x64_11_2_0_3_0_oci8_so_php_7 /usr/lib/php/20151012/oci8.so
- name: "Change ownership for Oracle InstantClient"
- name: Change ownership for Oracle InstantClient
file:
path: '{{ item }}'
owner: 'root'
group: 'root'
owner: root
group: root
recurse: yes
follow: no
with_items:
- '/usr/local/lib/instantclient_11_2'
- /usr/local/lib/instantclient_11_2
- name: "Ensure log directories"
- name: Ensure log directories
file:
path: '/usr/local/lib/instantclient_11_2/log/diag/clients'
owner: 'www-data'
group: 'root'
state: 'directory'
mode: '775'
path: /usr/local/lib/instantclient_11_2/log/diag/clients
owner: www-data
group: root
state: directory
mode: 775
follow: no
- name: "Set permissions in log directories"
- name: Set permissions in log directories
file:
path: '/usr/local/lib/instantclient_11_2/log'
owner: 'www-data'
group: 'root'
mode: '775'
path: /usr/local/lib/instantclient_11_2/log
owner: www-data
group: root
mode: 775
recurse: yes
follow: no
- name: "Make available libclntsh.so"
- name: Make available libclntsh.so
file:
src: '/usr/local/lib/instantclient_11_2/libclntsh.so.11.1'
dest: '/usr/local/lib/instantclient_11_2/libclntsh.so'
state: 'link'
src: /usr/local/lib/instantclient_11_2/libclntsh.so.11.1
dest: /usr/local/lib/instantclient_11_2/libclntsh.so
state: link
when: not oci_file.stat.exists
---
# file: roles/php/tasks/php.yml
- name: "PHP | Apt Repository"
- name: PHP | Apt Repository
apt_repository:
repo='{{ item }}'
state='present'
mode='644'
with_items: '{{ php_repositories }}'
- name: "PHP | Install required packages."
- name: PHP | Install required packages.
apt:
pkg={{ php_packages }}
state=present
......@@ -16,22 +16,22 @@
notify:
- "Apache | Restart Apache"
- name: "PHP | Hold em all"
- name: PHP | Hold em all
shell: dpkg --get-selections | grep ^php | sed s/install/hold/g | sudo dpkg --set-selections
when: php_hold_version
- name: "PHP | Install PECL packages"
shell: 'pecl install --soft imagick-3.3.0'
- name: PHP | Install PECL packages
shell: pecl install --soft imagick-3.3.0
when: php_version_main|default('7') != '7'
ignore_errors: true
# NOTE: If oauth is already installed and we install a new PHP 7 version then this fails and we need --force as well
- name: "PHP | Install PECL packages"
shell: 'pecl install --soft --force oauth'
- name: PHP | Install PECL packages
shell: pecl install --soft --force oauth
when: php_version_main|default('7') == '7'
ignore_errors: true
- name: "PHP | Ensure Apache config directory"
- name: PHP | Ensure Apache config directory
file:
dest=/etc/{{ php_base_dir }}/apache2
state=directory
......@@ -39,7 +39,7 @@
group=root
mode='755'
- name: "PHP | Configuration file, php.ini"
- name: PHP | Configuration file, php.ini
template:
src=etc-php5-apache2-php.ini
dest=/etc/{{ php_base_dir }}/apache2/php.ini
......@@ -52,7 +52,7 @@
- import_tasks: php53.yml
when: php_version|default('5.5') == '5.3'
- name: "PHP | Configuration file, fcgid.conf"
- name: PHP | Configuration file, fcgid.conf
template:
src=fcgid.conf
dest=/etc/apache2/mods-available/fcgid.conf
......@@ -62,7 +62,7 @@
notify:
- "Apache | Restart Apache"
- name: "PHP | Configuration files"
- name: PHP | Configuration files
template:
src=etc-php5-conf-d-{{ item }}.ini
dest=/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini
......@@ -70,11 +70,11 @@
group=root
mode='644'
with_items:
- 'opcache'
- opcache
notify:
- "Apache | Restart Apache"
- name: "PHP | Create extra directory for browscap"
- name: PHP | Create extra directory for browscap
file:
dest=/etc/{{ php_base_dir }}/apache2/extra
state=directory
......@@ -82,7 +82,7 @@
group=root
when: php_browscap
- name: "PHP | browscap.ini"
- name: PHP | browscap.ini
copy:
src=browscap.ini
dest=/etc/{{ php_base_dir }}/apache2/extra/browscap.ini
......@@ -92,14 +92,14 @@
notify:
- "Apache | Restart Apache"
- name: "PHP | Create htdocs directory for apc status"
- name: PHP | Create htdocs directory for apc status
file:
dest=/var/www/apc
state=directory
owner=www-data
group=www-data
- name: "PHP | Copy APC status php script"
- name: PHP | Copy APC status php script
copy:
src=apc.php
dest=/var/www/apc
......@@ -112,7 +112,7 @@
- import_tasks: msodbc.yml
when: php_needs_msodbc
- name: "PHP | Ensure ImageMagick config directory"
- name: PHP | Ensure ImageMagick config directory
file:
dest={{ php_imagick_config_dir }}
state=directory
......@@ -120,7 +120,7 @@
group=root
mode='755'
- name: "PHP | ImageMagick Policy File"
- name: PHP | ImageMagick Policy File
template:
src=etc-imagemagick-policy.xml
dest={{ php_imagick_config_dir }}/policy.xml
......@@ -130,7 +130,7 @@
- block:
- name: "PHP | Apache FPM Socket Configuration"
- name: PHP | Apache FPM Socket Configuration
template:
src='etc-apache2-conf-available-php-fpm'
dest='/etc/apache2/{{ apache_conf_dir }}/php{{ php_version_main }}-fpm.conf'
......@@ -140,14 +140,14 @@
notify:
- "Apache | Restart Apache"
- name: "PHP | Enable Apache PHP FPM Configuration"
- name: PHP | Enable Apache PHP FPM Configuration
command: a2enconf php{{ php_version_main }}-fpm creates=/etc/apache2/conf-enabled/php{{ php_version_main }}-fpm{{ apache_conf_ext }}
notify:
- "Apache | Restart Apache"
when: php_fpm_socket
- name: "PHP | FPM Default Pool Configuration"
- name: PHP | FPM Default Pool Configuration
template:
src=php_pool.conf
dest=/etc/{{ php_base_dir }}/fpm/pool.d/www.conf
......@@ -166,7 +166,7 @@
phpLibPrefix='5'
when: php_version_main|default('7') != '7'
- name: "Install logrotate script"
- name: Install logrotate script
template:
src=etc-logrotate-php
dest=/etc/logrotate.d/php{{ phpLogRotatePrefix }}-fpm
......@@ -174,4 +174,5 @@
group=root
mode='644'
when: php_fpm
tags: 'logrotate'
tags:
- logrotate
......@@ -3,20 +3,20 @@
---
# file: roles/php/tasks/php53.yml
- name: "Ensure PHP53 config directory"
- name: Ensure PHP53 config directory
file:
dest='{{ item }}'
state='directory'
with_items:
- '/etc/{{ php_base_dir }}/fpm/pool.d/'
- /etc/{{ php_base_dir }}/fpm/pool.d/
- name: "Check PHP 5.3 Requirement"
- name: Check PHP 5.3 Requirement
shell: php --version
register: php_version_available
changed_when: false
- block:
- name: "Package Preferences"
- name: Package Preferences
template:
src='preferences/{{ item }}'
dest='/etc/apt/preferences.d/{{ item }}-pin'
......@@ -24,54 +24,54 @@
group='root'
mode='644'
with_items:
- 'openssl'
- 'libssl'
- openssl
- libssl
- name: "Install Packages"
- name: Install Packages
apt:
pkg={{ packages }}
state=present
vars:
packages:
- 'autoconf2.13'
- 'automake1.4'
- 'build-essential'
- 'libc-client2007e'
- 'libc-client2007e-dev'
- 'libfcgi-dev'
- 'libfcgi0ldbl'
- 'libfreetype6-dev'
- 'libgif-dev'
- 'libgif4'
- 'libjpeg-progs'
- 'libjpeg62-dbg'
- 'libjpeg8'
- 'libjpeg8-dev'
- 'libmcrypt-dev'
- 'libmysqlclient-dev'
- 'libpcre++-dev'
- 'libpcre3-dev'
- 'libpng-dev'
- 'libssl-dev'
- 'libx11-dev'
- 'libxau-dev'
- 'libxcb1-dev'
- 'libxdmcp-dev'
- 'libxml2-dev'
- 'libxml2-dev'
- 'libxpm-dev'
- 'x11proto-core-dev'
- 'x11proto-input-dev'
- 'x11proto-kb-dev'
- 'xtrans-dev'
- name: "Link Client Lib"
- autoconf2.13
- automake1.4
- build-essential
- libc-client2007e
- libc-client2007e-dev
- libfcgi-dev
- libfcgi0ldbl
- libfreetype6-dev
- libgif-dev
- libgif4
- libjpeg-progs
- libjpeg62-dbg
- libjpeg8
- libjpeg8-dev
- libmcrypt-dev
- libmysqlclient-dev
- libpcre++-dev
- libpcre3-dev
- libpng-dev
- libssl-dev
- libx11-dev
- libxau-dev
- libxcb1-dev
- libxdmcp-dev
- libxml2-dev
- libxml2-dev
- libxpm-dev
- x11proto-core-dev
- x11proto-input-dev
- x11proto-kb-dev
- xtrans-dev
- name: Link Client Lib
file:
src='/usr/lib/libc-client.a'
dest='/usr/lib/x86_64-linux-gnu/libc-client.a'
state='link'
- name: "Make sure an empty directory /tmp/php53 exists"
- name: Make sure an empty directory /tmp/php53 exists
file:
path='/tmp/php53'
state='{{ item }}'
......@@ -79,25 +79,25 @@
- absent
- directory
- name: "Download PHP 5.3"
- name: Download PHP 5.3
get_url:
url='http://in1.php.net/distributions/php-5.3.29.tar.bz2'
dest='/tmp/php-5.3.29.tar.bz2'
- name: "Unpack PHP 5.3"
- name: Unpack PHP 5.3
unarchive:
src='/tmp/php-5.3.29.tar.bz2'
dest='/tmp/php53'
copy=no
- name: "Compile PHP 5.3"
- name: Compile PHP 5.3
shell: "{{ item }} chdir=/tmp/php53/php-5.3.29"
with_items:
- ./configure --with-libdir=/lib/x86_64-linux-gnu --enable-fpm --enable-mbstring --enable-sockets --with-zlib --enable-zip --with-imap-ssl --with-imap --with-curl --with-mcrypt --with-gd --with-mysql --with-pdo-mysql --with-mysqli --with-gettext --with-jpeg-dir=/usr --with-png-dir=/usr --with-kerberos --with-openssl --disable-cgi
- make
- make install
- name: "Create PHP53 Start Script"
- name: Create PHP53 Start Script
template:
src='etc-init-d-php53-fpm'
dest='/etc/init.d/php-fpm'
......@@ -105,12 +105,12 @@
group='root'
mode='755'
- name: "Add PHP-FPM to Boot-List"
- name: Add PHP-FPM to Boot-List
command: update-rc.d php-fpm defaults
when: '"PHP 5.3.29" not in php_version_available.stdout'
when: "PHP 5.3.29" not in php_version_available.stdout
- name: "Copy PHP53 Libraries"
- name: Copy PHP53 Libraries
copy:
src='php53/libs/{{ item.file }}'
dest='{{ php53.libdir }}/{{ item.file }}'
......@@ -119,7 +119,7 @@
mode='644'
with_items: '{{ php53.libraries }}'
- name: "Ensure PHP53 Library Links"
- name: Ensure PHP53 Library Links
file:
src='{{ php53.libdir }}/{{ item.file }}'
dest='{{ php53.libdir }}/{{ item.link }}'
......@@ -129,7 +129,7 @@
mode='644'
with_items: '{{ php53.libraries }}'
- name: "Ensure extra Library Links"
- name: Ensure extra Library Links
file:
src='{{ item.src }}'
dest='{{ php53.libdir }}/{{ item.link }}'
......@@ -139,7 +139,7 @@
mode='644'
with_items: '{{ php53.liblinks }}'
- name: "Copy PHP53 Modules"
- name: Copy PHP53 Modules
copy:
src='php53/{{ item }}.so'
dest='{{ php53.extdir }}/{{ item }}.so'
......@@ -148,7 +148,7 @@
mode='644'
with_items: '{{ php53.modules }}'
- name: "Create PHP53 INI Files"
- name: Create PHP53 INI Files
template:
src='etc-php5-apache2-php.ini'
dest='/etc/{{ php_base_dir }}/{{ item }}/php.ini'
......@@ -156,6 +156,6 @@
group='root'
mode='644'
with_items:
- 'cgi53'
- 'cli53'
- 'fpm'
- cgi53
- cli53
- fpm
......@@ -2,9 +2,13 @@
# file: roles/php/tasks/variables.yml
- block:
- set_fact: phpFpmService='php5-fpm'
- set_fact: phpFpmService='php-fpm'
- set_fact:
phpFpmService: php5-fpm
- set_fact:
phpFpmService: php-fpm
when: php_version_main|default('7') == '5'
- set_fact: phpFpmService='php{{php_version|default("7.0")}}-fpm'
- set_fact:
phpFpmService: php{{php_version|default("7.0")}}-fpm
when: php_version_main|default('7') == '7'
tags: 'always'
tags:
- always
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment