https://github.com/sansible/php
See https://github.com/sansible/sansible for more information
https://github.com/sansible/php
ansible ansible-role ansible-roles php
Last synced: about 1 year ago
JSON representation
See https://github.com/sansible/sansible for more information
- Host: GitHub
- URL: https://github.com/sansible/php
- Owner: sansible
- License: mit
- Created: 2016-01-28T15:58:21.000Z (over 10 years ago)
- Default Branch: develop
- Last Pushed: 2023-01-24T23:25:26.000Z (over 3 years ago)
- Last Synced: 2025-03-23T11:04:40.911Z (over 1 year ago)
- Topics: ansible, ansible-role, ansible-roles, php
- Language: Shell
- Homepage:
- Size: 54.7 KB
- Stars: 3
- Watchers: 7
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP
Master: 
Develop: 
* [ansible.cfg](#ansible-cfg)
* [Dependencies](#dependencies)
* [Tags](#tags)
* [Examples](#examples)
This is a role to install PHP with CLI and FPM support.
This playbook allows you to create isolated per application user FPM services.
This comes with some limitations:
* One FPM service for one application (OS) user
* One application root directory
* One php.ini per application (OS) user
* You have to provide control handlers for the user specific FPM service.
## Dependencies
No dependencies
## Tags
This role uses one tag: **build**
* `build` - Installs PHP.
## Arguments
See [defaults/main.yml](defaults/main.yml)
~
## Testing
### Test all scenarios
`make test`
Note: The test container/s will NOT be left running, so for troubleshooting you may want to specify the scenario as per option below
### Test a single, specified scenario
`SCENARIO= make test`
Note: The test container/s WILL be left running. They can be removed with `make destroy` or `make clean`.
## Examples
To simply add PHP7.3 to your box.
```YAML
- name: My Awesome Playbook
hosts: sandbox
pre_tasks:
- name: Update apt
become: yes
apt:
cache_valid_time: 1800
update_cache: yes
tags:
- build
roles:
- role: sansible.php
```
Install a different version of PHP to your box.
```YAML
- name: My Awesome Playbook
hosts: sandbox
pre_tasks:
- name: Update apt
become: yes
apt:
cache_valid_time: 1800
update_cache: yes
tags:
- build
roles:
- role: sansible.php
sansible_php_version: php7.2
```
If you want to install some extra PHP packages, simply add it to `sansible_php_extras` list.
```YAML
- name: My Awesome Playbook
hosts: sandbox
pre_tasks:
- name: Update apt
become: yes
apt:
cache_valid_time: 1800
update_cache: yes
tags:
- build
roles:
- role: sansible.php
sansible_php_extras:
- php5-xdebug
```
If you want to install PHP with a custom FPM worker.
```YAML
- name: My Awesome Playbook
hosts: sandbox
pre_tasks:
- name: Update apt
become: yes
apt:
cache_valid_time: 1800
update_cache: yes
tags:
- build
roles:
- role: sansible.php
sansible_php_fpm_description: my awesome application
sansible_php_fpm_chroot: /home/my_awesome_application/code/public
sansible_php_fpm_group: awesome_application
sansible_php_fpm_user: awesome_application
```
If you want complete control over installed packages (ie. to preserve exact versions):
```YAML
- name: My Awesome Playbook
hosts: sandbox
pre_tasks:
- name: Update apt
become: yes
apt:
cache_valid_time: 1800
update_cache: yes
tags:
- build
roles:
- role: sansible.php
sansible_php_install_base_packages: no
sansible_php_modules:
- php7.3=7.0.32*
- php7.3-common=7.0.32*
- php7.3-fpm=7.0.32*
- php7.3-cli=7.0.32*
```