Skip to content
This repository has been archived by the owner on Aug 20, 2019. It is now read-only.

Commit

Permalink
Allow easy switching of PHP versions. (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
thom8 authored Jun 13, 2016
1 parent 3775d5a commit fcd668d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 13 deletions.
11 changes: 9 additions & 2 deletions provisioning/ansible/config/beetbox.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ php_display_startup_errors: "On"
php_enable_php_fpm: 1
php_realpath_cache_size: "1024K"
php_sendmail_path: "/usr/sbin/ssmtp -t"
php_enable_apc: no
php_opcache_enabled_in_ini: true
php_opcache_memory_consumption: "192"
php_opcache_max_accelerated_files: 4096
Expand All @@ -272,7 +273,7 @@ php_extension_conf_paths:
php_fpm_daemon: "php{{ php_version }}-fpm"
php_fpm_conf_path: "/etc/php/{{ php_version }}/fpm"
php_mysql_package: "php{{ php_version }}-mysql"
php_memcached_package: "php{{ php_version }}-memcached"
php_memcached_package: "php-memcache"
php55_packages:
- php5.5
- php5.5-curl
Expand All @@ -285,12 +286,18 @@ php55_packages:
- libapache2-mod-php5.5
php56_packages:
- php5.6
- php5.6-cli
- php5.6-common
- php5.6-curl
- php5.6-dev
- php5.6-fpm
- php5.6-gd
- php5.6-intl
- php5.6-json
- php5.6-mbstring
- php5.6-mysql
- php5.6-opcache
- php5.6-readline
- php5.6-xml
- libapache2-mod-php5.6
php70_packages:
Expand Down Expand Up @@ -355,4 +362,4 @@ mailhog_daemonize_bin_path: /usr/sbin/daemonize

# Other config.
known_hosts_path: ~/.ssh/known_hosts
workspace: "{{ beet_home }}/workspace"
workspace: "{{ beet_home }}/workspace/{{ php_version }}"
2 changes: 1 addition & 1 deletion provisioning/ansible/roles/beetbox-common/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
# Conditionally-installed roles.
- { role: ANXS.postgresql, when: "{{ installed_extras_postgresql }}" }
- { role: geerlingguy.memcached, when: "{{ installed_extras_memcached }}" }
- { role: geerlingguy.php-memcached, when: "{{ installed_extras_memcached }} and ({{ php_version }} != '7.0')" }
- { role: geerlingguy.php-memcached, when: "{{ installed_extras_memcached }}" }
- { role: geerlingguy.php-xdebug, when: "{{ installed_extras_xdebug }}" }
- { role: geerlingguy.php-xhprof, when: "{{ installed_extras_xhprof }}" }
- { role: geerlingguy.blackfire, when: "{{ installed_extras_blackfire }}" }
Expand Down
1 change: 0 additions & 1 deletion provisioning/ansible/roles/beetbox-init/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
path: "{{ workspace }}"
state: directory
mode: 0775
become: no
when: workspace is defined

- name: Set SSH home directory.
Expand Down
46 changes: 37 additions & 9 deletions provisioning/ansible/roles/beetbox-php-ppa/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
---
- set_fact:
php_ppa: ppa:ondrej/php
when: php_version == '5.5' or php_version == '5.6' or php_version == '7.0'

- name: Add repository for PHP.
apt_repository:
repo: "{{ php_ppa }}"
repo: "ppa:ondrej/php"
update_cache: yes

- name: Purge PHP version packages.
apt:
name: "{{ item }}"
state: absent
when: "'php{{ php_version }}' != item"
purge: yes
force: yes
when: "'{{ php_version }}' not in item"
with_items:
- "{{ php55_packages }} + {{ php56_packages }} + {{ php70_packages }}"
register: php_purge

- name: Purge depreciated memcached package.
apt:
name: "{{ item }}"
state: absent
purge: yes
force: yes
when: php_purge.changed
with_items:
- "php-memcached"

- name: Purge PHP modules directory.
file:
path: "{{ item }}"
state: absent
when: php_purge.changed
with_items:
- php5.5
- php5.6
- php7.0
- "/usr/lib/php5/modules"
- "/usr/lib/php/modules"

- name: Set PHP 5.5 packages.
set_fact:
Expand All @@ -33,6 +49,8 @@
php_packages: "{{ php70_packages }}"
when: php_version == '7.0'

# PHP 7 Support

- name: Set default PHP7 mysql package.
set_fact:
php_mysql_package: php7.0-mysql
Expand All @@ -47,3 +65,13 @@
set_fact:
php_fpm_pool_conf_path: "/etc/php/7.0/fpm/pool.d/www.conf"
when: (php_version == '7.0') and (php_fpm_pool_conf_path is not defined)

- name: Set xhprof_download_url for PHP7.
set_fact:
xhprof_download_url: https://github.com/RustJason/xhprof/archive/php7.zip
when: php_version == '7.0'

- name: Set xhprof_download_folder_name for PHP7.
set_fact:
xhprof_download_folder_name: xhprof-php7
when: php_version == '7.0'

0 comments on commit fcd668d

Please sign in to comment.