Initial commit, direct port from Drupal VM.
This commit is contained in:
commit
d3100441de
|
@ -0,0 +1,2 @@
|
||||||
|
*.retry
|
||||||
|
tests/test.sh
|
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
services: docker
|
||||||
|
|
||||||
|
env:
|
||||||
|
- distro: centos7
|
||||||
|
- distro: centos6
|
||||||
|
- distro: debian8
|
||||||
|
- distro: ubuntu1604
|
||||||
|
- distro: ubuntu1404
|
||||||
|
|
||||||
|
script:
|
||||||
|
# Configure test script so we can run extra tests after playbook is run.
|
||||||
|
- export container_id=$(date +%s)
|
||||||
|
- export cleanup=false
|
||||||
|
|
||||||
|
# Download test shim.
|
||||||
|
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
|
||||||
|
- chmod +x ${PWD}/tests/test.sh
|
||||||
|
|
||||||
|
# Run tests.
|
||||||
|
- ${PWD}/tests/test.sh
|
||||||
|
|
||||||
|
# Run script to test PHP version.
|
||||||
|
# TODO: Actually test the version.
|
||||||
|
- 'docker exec ${container_id} env TERM=xterm php -v'
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
@ -0,0 +1,20 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2017 Jeff Geerling
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Ansible Role: PHP Versions
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-php-versions.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-php-versions)
|
||||||
|
|
||||||
|
Allows different PHP versions to be installed when using the `geerlingguy.php` role (or a similar role). This role was originally built for [Drupal VM](https://www.drupalvm.com) but was released more generically so others could use an easier mechanism for switching PHP versions.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
N/A
|
||||||
|
|
||||||
|
## Role Variables
|
||||||
|
|
||||||
|
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||||
|
|
||||||
|
php_version: '7.1'
|
||||||
|
|
||||||
|
The PHP version to be installed. Any [currently-supported PHP major version](http://php.net/supported-versions.php) is a valid option (e.g. `5.6`, `7.0`, `7.1`, etc.
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- geerlingguy.php is a soft dependency as the `php_version` variable is required to be set.
|
||||||
|
- geerlingguy.repo-remi, if you're using CentOS or a Red Hat derivative.
|
||||||
|
|
||||||
|
## Example Playbook
|
||||||
|
|
||||||
|
- hosts: webservers
|
||||||
|
|
||||||
|
vars:
|
||||||
|
php_version: 7.1
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: geerlingguy.repo-remi
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
- geerlingguy.php-versions
|
||||||
|
- geerlingguy.php
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT / BSD
|
||||||
|
|
||||||
|
## Author Information
|
||||||
|
|
||||||
|
This role was created in 2017 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
# The PHP version to be installed.
|
||||||
|
php_version: '7.1'
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- geerlingguy.php
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
author: geerlingguy
|
||||||
|
description: Allows different PHP versions to be installed.
|
||||||
|
company: "Midwestern Mac, LLC"
|
||||||
|
license: "license (BSD, MIT)"
|
||||||
|
issue_tracker_url: https://github.com/geerlingguy/drupal-vm/issues
|
||||||
|
min_ansible_version: 2.2
|
||||||
|
platforms:
|
||||||
|
- name: EL
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Ubuntu
|
||||||
|
versions:
|
||||||
|
- precise
|
||||||
|
- raring
|
||||||
|
- saucy
|
||||||
|
- trusty
|
||||||
|
- xenial
|
||||||
|
galaxy_tags:
|
||||||
|
- php
|
||||||
|
- web
|
||||||
|
- drupal
|
||||||
|
- vm
|
||||||
|
- magento
|
||||||
|
- wordpress
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- name: Include OS-specific variables.
|
||||||
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
|
|
||||||
|
# Setup tasks.
|
||||||
|
- include: "setup-{{ ansible_os_family }}.yml"
|
||||||
|
static: no
|
||||||
|
|
||||||
|
- name: Set the correct XHProf package when PHP 5.6 is used.
|
||||||
|
set_fact:
|
||||||
|
xhprof_download_url: https://github.com/phacility/xhprof/archive/master.tar.gz
|
||||||
|
xhprof_download_folder_name: xhprof-master
|
||||||
|
when: php_version == '5.6'
|
|
@ -0,0 +1,52 @@
|
||||||
|
---
|
||||||
|
- name: Set the correct opcache filename (Ubuntu).
|
||||||
|
set_fact:
|
||||||
|
php_opcache_conf_filename: "10-opcache.ini"
|
||||||
|
when: ansible_distribution == "Ubuntu"
|
||||||
|
|
||||||
|
- name: Add repository for PHP versions (Ubuntu).
|
||||||
|
apt_repository: repo='ppa:ondrej/php'
|
||||||
|
when: ansible_distribution == "Ubuntu"
|
||||||
|
|
||||||
|
- name: Add repository for PHP 5 compatibility packages (Ubuntu).
|
||||||
|
apt_repository: repo='ppa:ondrej/php5-compat'
|
||||||
|
when: php_version == "5.6" and ansible_distribution == "Ubuntu"
|
||||||
|
|
||||||
|
# Debian-specific tasks.
|
||||||
|
- name: Add dependencies for PHP versions (Debian).
|
||||||
|
apt:
|
||||||
|
name: "{{ item }}"
|
||||||
|
with_items:
|
||||||
|
- apt-transport-https
|
||||||
|
- ca-certificates
|
||||||
|
when: ansible_distribution == "Debian"
|
||||||
|
|
||||||
|
- name: Add Ondrej Sury's apt key (Debian).
|
||||||
|
apt_key:
|
||||||
|
url: https://packages.sury.org/php/apt.gpg
|
||||||
|
state: present
|
||||||
|
when: ansible_distribution == "Debian"
|
||||||
|
|
||||||
|
- name: Add Ondrej Sury's repo (Debian).
|
||||||
|
apt_repository:
|
||||||
|
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
|
||||||
|
state: present
|
||||||
|
register: php_ondrej_debian_repo
|
||||||
|
when: ansible_distribution == "Debian"
|
||||||
|
|
||||||
|
- name: Update apt caches after repo is added (Debian).
|
||||||
|
apt: update_cache=yes
|
||||||
|
when: php_ondrej_debian_repo.changed and (ansible_distribution == "Debian")
|
||||||
|
|
||||||
|
# PHP package purges.
|
||||||
|
- name: Purge PHP version packages.
|
||||||
|
apt:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
purge: yes
|
||||||
|
force: yes
|
||||||
|
when: "'php' + php_version not in item"
|
||||||
|
with_flattened:
|
||||||
|
- "{{ php_packages|regex_replace('php' + php_version, 'php5.6') }}"
|
||||||
|
- "{{ php_packages|regex_replace('php' + php_version, 'php7.0') }}"
|
||||||
|
- "{{ php_packages|regex_replace('php' + php_version, 'php7.1') }}"
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
- name: Enable remi repo for PHP 5.6.
|
||||||
|
set_fact: php_enablerepo="remi,remi-php56"
|
||||||
|
when: php_version == "5.6"
|
||||||
|
|
||||||
|
- name: Enable remi repo for PHP 7.0.
|
||||||
|
set_fact: php_enablerepo="remi,remi-php70"
|
||||||
|
when: php_version == "7.0"
|
||||||
|
|
||||||
|
- name: Enable remi repo for PHP 7.1.
|
||||||
|
set_fact: php_enablerepo="remi,remi-php71"
|
||||||
|
when: php_version == "7.1"
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Ansible Role tests
|
||||||
|
|
||||||
|
To run the test playbook(s) in this directory:
|
||||||
|
|
||||||
|
1. Install and start Docker.
|
||||||
|
1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`:
|
||||||
|
- `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/`
|
||||||
|
1. Make the test shim executable: `chmod +x tests/test.sh`.
|
||||||
|
1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh`
|
||||||
|
|
||||||
|
If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)`
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
- src: geerlingguy.repo-remi
|
||||||
|
- src: geerlingguy.php
|
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
vars:
|
||||||
|
php_enable_webserver: false
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Update apt cache.
|
||||||
|
apt: update_cache=yes cache_valid_time=600
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: geerlingguy.repo-remi
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
- role_under_test
|
||||||
|
- geerlingguy.php
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
# Configure PHP paths and packages for PHP 5.6 and PHP 7.0.
|
||||||
|
php_conf_paths:
|
||||||
|
- "/etc/php/{{ php_version }}/fpm"
|
||||||
|
- "/etc/php/{{ php_version }}/apache2"
|
||||||
|
- "/etc/php/{{ php_version }}/cli"
|
||||||
|
php_extension_conf_paths:
|
||||||
|
- "/etc/php/{{ php_version }}/fpm/conf.d"
|
||||||
|
- "/etc/php/{{ php_version }}/apache2/conf.d"
|
||||||
|
- "/etc/php/{{ php_version }}/cli/conf.d"
|
||||||
|
php_fpm_daemon: "php{{ php_version }}-fpm"
|
||||||
|
php_fpm_conf_path: "/etc/php/{{ php_version }}/fpm"
|
||||||
|
php_fpm_pool_conf_path: "{{ php_fpm_conf_path }}/pool.d/www.conf"
|
||||||
|
php_mysql_package: "php{{ php_version }}-mysql"
|
||||||
|
php_redis_package: "php{{ php_version }}-redis"
|
||||||
|
php_memcached_package: "php{{ php_version }}-memcached"
|
||||||
|
php_pgsql_package: "php{{ php_version }}-pgsql"
|
||||||
|
|
||||||
|
php_tideways_module_path: "/usr/lib/php/{{ php_version }}/modules"
|
||||||
|
php_uploadprogress_module_path: "/usr/lib/php/{{ php_version }}/modules"
|
||||||
|
php_xdebug_module_path: "/usr/lib/php/{{ php_version }}/modules"
|
||||||
|
php_xhprof_module_path: "/usr/lib/php/{{ php_version }}/modules"
|
||||||
|
|
||||||
|
php_packages:
|
||||||
|
- "php{{ php_version }}"
|
||||||
|
- "php{{ php_version }}-apcu"
|
||||||
|
- "php{{ php_version }}-cli"
|
||||||
|
- "php{{ php_version }}-common"
|
||||||
|
- "php{{ php_version }}-curl"
|
||||||
|
- "php{{ php_version }}-dev"
|
||||||
|
- "php{{ php_version }}-fpm"
|
||||||
|
- "php{{ php_version }}-gd"
|
||||||
|
- "php{{ php_version }}-imap"
|
||||||
|
- "php{{ php_version }}-json"
|
||||||
|
- "php{{ php_version }}-mbstring"
|
||||||
|
- "php{{ php_version }}-mcrypt"
|
||||||
|
- "php{{ php_version }}-opcache"
|
||||||
|
- "php{{ php_version }}-sqlite3"
|
||||||
|
- "php{{ php_version }}-xml"
|
||||||
|
- "php{{ php_version }}-yaml"
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
php_tideways_module_path: "/usr/lib64/php{{ php_version }}/modules"
|
||||||
|
php_uploadprogress_module_path: "/usr/lib64/php{{ php_version }}/modules"
|
||||||
|
php_xdebug_module_path: "/usr/lib64/php{{ php_version }}/modules"
|
||||||
|
php_xhprof_module_path: "/usr/lib64/php{{ php_version }}/modules"
|
Loading…
Reference in New Issue