mirror of
https://github.com/geerlingguy/ansible-role-php.git
synced 2024-11-28 12:45:16 +01:00
Add Debian/Ubuntu support to PHP role.
This commit is contained in:
parent
56802487a0
commit
b83594a0ba
15
README.md
15
README.md
@ -1,6 +1,6 @@
|
|||||||
# Ansible Role: PHP
|
# Ansible Role: PHP
|
||||||
|
|
||||||
Installs PHP on RedHat Enterprise Linux or CentOS 6.x servers.
|
Installs PHP on RedHat/CentOS and Debian/Ubuntu servers.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -10,10 +10,6 @@ None.
|
|||||||
|
|
||||||
Available variables are listed below, along with default values (see `vars/main.yml`):
|
Available variables are listed below, along with default values (see `vars/main.yml`):
|
||||||
|
|
||||||
php_enablerepo: ""
|
|
||||||
|
|
||||||
If you have enabled any additional repositories (might I suggest geerlingguy.repo-epel or geerlingguy.repo-remi), those repositories can be listed under this variable (e.g. `remi,epel`). This can be handy, as an example, if you want to install the latest version of PHP 5.4, which is in the Remi repository.
|
|
||||||
|
|
||||||
php_memory_limit: "256M"
|
php_memory_limit: "256M"
|
||||||
php_max_execution_time: "60"
|
php_max_execution_time: "60"
|
||||||
php_upload_max_filesize: "64M"
|
php_upload_max_filesize: "64M"
|
||||||
@ -33,7 +29,11 @@ Explicitly set PHP's date timezone system-wide.
|
|||||||
|
|
||||||
php_packages: []
|
php_packages: []
|
||||||
|
|
||||||
A list of the PHP packages to install. You'll likely want to install common packages like `php`, `php-cli`, `php-devel` and `php-pdo`, and you can add in whatever other packages you'd like (for example, `php-gd` for image manipulation, or `php-ldap` if you need to connect to an LDAP server for authentication).
|
A list of the PHP packages to install (OS-specific by default). You'll likely want to install common packages like `php`, `php-cli`, `php-devel` and `php-pdo`, and you can add in whatever other packages you'd like (for example, `php-gd` for image manipulation, or `php-ldap` if you need to connect to an LDAP server for authentication).
|
||||||
|
|
||||||
|
php_enablerepo: ""
|
||||||
|
|
||||||
|
(RedHat/CentOS only) If you have enabled any additional repositories (might I suggest geerlingguy.repo-epel or geerlingguy.repo-remi), those repositories can be listed under this variable (e.g. `remi,epel`). This can be handy, as an example, if you want to install the latest version of PHP 5.4, which is in the Remi repository.
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
@ -62,12 +62,13 @@ A list of the PHP packages to install. You'll likely want to install common pack
|
|||||||
- php-pdo
|
- php-pdo
|
||||||
- php-pecl-apc
|
- php-pecl-apc
|
||||||
- php-xml
|
- php-xml
|
||||||
|
...
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Make role more flexible, allowing APC to be excluded from `php_packages` list.
|
- Make role more flexible, allowing APC to be excluded from `php_packages` list.
|
||||||
- Use `lineinfile` rather than templates to make configuration changes.
|
- Use `lineinfile` rather than templates to make configuration changes.
|
||||||
- Remove apache dependency (better way of using handler?).
|
- Remove apache dependency (better way of using handler? Way to get around Debian/apt's apache2 + php bindings?).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -12,6 +12,12 @@ galaxy_info:
|
|||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- 6
|
- 6
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Ubuntu
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
categories:
|
categories:
|
||||||
- development
|
- development
|
||||||
- web
|
- web
|
||||||
|
@ -1,13 +1,30 @@
|
|||||||
---
|
---
|
||||||
# PHP.
|
- name: Include OS-specific variables.
|
||||||
- name: Ensure PHP packages are installed.
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
yum: name={{ item }} state=installed enablerepo={{ php_enablerepo }}
|
|
||||||
|
- name: Ensure PHP packages are installed (RedHat).
|
||||||
|
yum: >
|
||||||
|
name={{ item }}
|
||||||
|
state=installed
|
||||||
|
enablerepo={{ php_enablerepo }}
|
||||||
with_items: php_packages
|
with_items: php_packages
|
||||||
notify: restart apache
|
notify: restart apache
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
|
- name: Ensure PHP packages are installed (Debian).
|
||||||
|
apt: >
|
||||||
|
name={{ item }}
|
||||||
|
state=installed
|
||||||
|
with_items: php_packages
|
||||||
|
notify: restart apache
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: Place PHP configuration files in place.
|
- name: Place PHP configuration files in place.
|
||||||
template: src={{ item.src }} dest={{ item.dest }} owner=root group=root mode=644
|
template: >
|
||||||
|
src={{ item.src }}
|
||||||
|
dest={{ item.dest }}
|
||||||
|
owner=root group=root mode=644
|
||||||
with_items:
|
with_items:
|
||||||
- { src: php.ini.j2, dest: /etc/php.ini }
|
- { src: php.ini.j2, dest: "{{ php_conf_path }}/php.ini" }
|
||||||
- { src: apc.ini.j2, dest: /etc/php.d/php.ini }
|
- { src: apc.ini.j2, dest: "{{ php_extension_conf_path }}/{{ php_apc_conf_filename }}" }
|
||||||
notify: restart apache
|
notify: restart apache
|
||||||
|
14
vars/Debian.yml
Normal file
14
vars/Debian.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
php_conf_path: /etc/php5/apache2
|
||||||
|
php_extension_conf_path: /etc/php5/conf.d
|
||||||
|
php_apc_conf_filename: 20-apc.ini
|
||||||
|
php_packages:
|
||||||
|
- php5
|
||||||
|
- libapache2-mod-php5
|
||||||
|
- php5-mcrypt
|
||||||
|
- php5-cli
|
||||||
|
- php5-common
|
||||||
|
- php5-dev
|
||||||
|
- php5-gd
|
||||||
|
- php5-ldap
|
||||||
|
- php-apc
|
19
vars/RedHat.yml
Normal file
19
vars/RedHat.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
php_conf_path: /etc
|
||||||
|
php_extension_conf_path: /etc/php.d
|
||||||
|
php_apc_conf_filename: apc.ini
|
||||||
|
php_packages:
|
||||||
|
- ImageMagick
|
||||||
|
- php
|
||||||
|
- php-cli
|
||||||
|
- php-common
|
||||||
|
- php-devel
|
||||||
|
- php-gd
|
||||||
|
- php-imap
|
||||||
|
- php-ldap
|
||||||
|
- php-mbstring
|
||||||
|
- php-pdo
|
||||||
|
- php-pear
|
||||||
|
- php-pecl-apc
|
||||||
|
- php-xml
|
||||||
|
- php-xmlrpc
|
@ -7,18 +7,4 @@ php_upload_max_filesize: "64M"
|
|||||||
php_apc_cache_by_default: "1"
|
php_apc_cache_by_default: "1"
|
||||||
php_apc_shm_size: "96M"
|
php_apc_shm_size: "96M"
|
||||||
php_date_timezone: "America/Chicago"
|
php_date_timezone: "America/Chicago"
|
||||||
php_packages:
|
php_packages: []
|
||||||
- ImageMagick
|
|
||||||
- php
|
|
||||||
- php-cli
|
|
||||||
- php-common
|
|
||||||
- php-devel
|
|
||||||
- php-gd
|
|
||||||
- php-imap
|
|
||||||
- php-ldap
|
|
||||||
- php-mbstring
|
|
||||||
- php-pdo
|
|
||||||
- php-pear
|
|
||||||
- php-pecl-apc
|
|
||||||
- php-xml
|
|
||||||
- php-xmlrpc
|
|
||||||
|
Loading…
Reference in New Issue
Block a user