Dirty commit

pull/5/head
Emilien Mantel 2015-07-23 10:40:33 +02:00
parent fb58b778ec
commit adc65ec287
10 changed files with 124 additions and 136 deletions

View File

@ -1,2 +1,32 @@
---
# defaults file for .
php_install_fpm: true
php_extra_packages: []
# php.ini config
php_ini:
- key: 'date.timezone'
value: 'Europe/Paris'
- key: 'expose_php'
value: 'Off'
- key: 'memory_limit'
value: '256M'
# OpCache settings (useful for PHP >=5.5).
php_opcache_enable: "1"
php_opcache_enable_cli: "0"
php_opcache_memory_consumption: "96"
php_opcache_interned_strings_buffer: "16"
php_opcache_max_accelerated_files: "4096"
php_opcache_max_wasted_percentage: "5"
php_opcache_validate_timestamps: "1"
php_opcache_revalidate_freq: "2"
php_opcache_max_file_size: "0"
# APC settings (useful for PHP <5.5).
php_apc_cache_by_default: "1"
php_apc_shm_size: "96M"
php_apc_stat: "1"
php_apc_enable_cli: "0"
# PHP-FPM

View File

@ -1,2 +1,4 @@
---
# handlers file for .
- name: restart php-fpm
action: service name=php5-fpm state=restarted

View File

@ -1,135 +1,16 @@
---
galaxy_info:
author: your name
description:
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
#- name: EL
# versions:
# - all
# - 5
# - 6
# - 7
#- name: GenericUNIX
# versions:
# - all
# - any
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
#- name: SmartOS
# versions:
# - all
# - any
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
#- name: GenericBSD
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
#- name: Ubuntu
# versions:
# - all
# - lucid
# - maverick
# - natty
# - oneiric
# - precise
# - quantal
# - raring
# - saucy
# - trusty
# - utopic
# - vivid
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
#- name: GenericLinux
# versions:
# - all
# - any
#- name: Debian
# versions:
# - all
# - etch
# - jessie
# - lenny
# - squeeze
# - wheezy
#
# Below are all categories currently available. Just as with
# the platforms above, uncomment those that apply to your role.
#
#categories:
#- cloud
#- cloud:ec2
#- cloud:gce
#- cloud:rax
#- clustering
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web
author: Emilien Mantel
description: Install and configure PHP (+ FPM is wanted)
company:
license: GPLv2
min_ansible_version: 1.8
- name: Debian
versions:
- wheezy
- jessie
categories:
- development
- web
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

10
tasks/fpm.yml 100644
View File

@ -0,0 +1,10 @@
---
- name: APT | Install PHP-FPM
apt: pkg=php5-fpm state=latest
- name: LINEINFILE | PHP configuration
lineinfile: dest=/etc/php5/fpm/php.ini regexp='^;?{{ item.key }}' line='{{ item.key }} = {{ item.value }}'
with_items: php_ini
notify: restart php-fpm

View File

@ -1,2 +1,25 @@
---
# tasks file for .
- name: APT | Install PHP packages
apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time=3600
with_items:
- php_packages
- php_extra_packages
- name: INCLUDE | PHP-FPM
include: php-fpm.yml
when: php_install_fpm
- name: SHELL | Get PHP version on apt
shell: LANG=C apt-cache policy php5 2>&1 | awk '/Candidate:/ { print $2 }'
register: php_apt_version
changed_when: false
- name: APT | Install and configure php-apcu / opcache (PHP 5.5+ only)
include: php55min.yml
when: php_apt_version.stdout|version_compare('5.5', 'ge', False)
- name: APT | Install and configure php-apc (PHP 5.4 max only)
include: php54max.yml
when: php_apt_version.stdout|version_compare('5.5', 'lt', False)

11
tasks/php55min.yml 100644
View File

@ -0,0 +1,11 @@
---
- name: APT | Install php-apcu
apt: pkg=php5-apcu state=latest
- name: TEMPLATE | Configure Opcache / APCu
template: src=etc/php5/mods-available/{{ item }}.j2 dest=/etc/php5/mods-available/{{ item }}
with_items:
- apcu
- opcache
notify: restart php-fpm

View File

@ -0,0 +1,5 @@
;
; {{ ansible_managed }}
;
extension=apcu.so

View File

@ -0,0 +1,17 @@
;
; {{ ansible_managed }}
;
; configuration for php ZendOpcache module
; priority=05
zend_extension=opcache.so
opcache.enable={{ php_opcache_enable }}
opcache.enable_cli={{ php_opcache_enable_cli }}
opcache.memory_consumption={{ php_opcache_memory_consumption }}
opcache.interned_strings_buffer={{ php_opcache_interned_strings_buffer }}
opcache.max_accelerated_files={{ php_opcache_max_accelerated_files }}
opcache.max_wasted_percentage={{ php_opcache_max_wasted_percentage }}
opcache.validate_timestamps={{ php_opcache_validate_timestamps }}
opcache.revalidate_freq={{ php_opcache_revalidate_freq }}
opcache.max_file_size={{ php_opcache_max_file_size }}

View File

@ -1,2 +1,11 @@
---
# vars file for .
php_packages:
- php5-cli
- php5-curl
- php5-gd
- php5-mcrypt
- php5-mysqlnd
- php5-intl
- php5-dev