This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
sudo: required | ||
|
||
env: | ||
- distribution: centos | ||
version: 7 | ||
init: /usr/lib/systemd/systemd | ||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" | ||
SITE: source | ||
- distribution: ubuntu | ||
version: 14.04 | ||
init: /sbin/init | ||
run_opts: "" | ||
SITE: source | ||
- distribution: ubuntu | ||
version: 12.04 | ||
init: /sbin/init | ||
run_opts: "" | ||
SITE: source | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
# Pull container | ||
- 'sudo docker pull ${distribution}:${version}' | ||
# Customize container | ||
- 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests' | ||
|
||
script: | ||
- container_id=$(mktemp) | ||
# Run container in detached state | ||
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"' | ||
|
||
# Install dependencies. | ||
- 'sudo docker exec "$(cat ${container_id})" ansible-galaxy install geerlingguy.php geerlingguy.repo-remi' | ||
|
||
# Ansible syntax check. | ||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml --syntax-check' | ||
|
||
# Test role. | ||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml' | ||
|
||
# Test role idempotence. | ||
- > | ||
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml | ||
| grep -q 'changed=0.*failed=0' | ||
&& (echo 'Idempotence test: pass' && exit 0) | ||
|| (echo 'Idempotence test: fail' && exit 1) | ||
# Run script to test if Upload progress is available and working. | ||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm php /etc/ansible/roles/role_under_test/tests/uploadprogress-test.php' | ||
|
||
# Clean up | ||
- 'sudo docker stop "$(cat ${container_id})"' | ||
|
||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Ansible Role: Upload progress | ||
|
||
[![CircleCI](https://circleci.com/gh/beetboxvm/ansible-role-beetbox-upload-progress.svg?style=svg)](https://circleci.com/gh/beetboxvm/ansible-role-beetbox-upload-progress) | ||
|
||
Installs Upload progress PHP extension on Linux servers. | ||
|
||
## Requirements | ||
|
||
Prior to running this role, make sure the `php-devel` and `@Development Tools` (for RHEL/CentOS) or `php5-dev` + `build-essential` packages (for Debian/Ubuntu) are present on the system, as they are required for the build of Upload progress. | ||
|
||
## Role Variables | ||
|
||
Available variables are listed below, along with default values (see `defaults/main.yml`): | ||
|
||
workspace: /root | ||
|
||
Where Xdebug setup files will be downloaded and built. | ||
|
||
php_uploadprogress_module_path: /usr/lib/php5/modules | ||
|
||
The path where `uploadprogress.so` will be installed. | ||
|
||
php_uploadprogress_config_filename: 20-uploadprogress.ini | ||
|
||
The file name for PHP config. | ||
|
||
## Dependencies | ||
|
||
- geerlingguy.php | ||
|
||
## Example Playbook | ||
|
||
- hosts: webservers | ||
roles: | ||
- { role: beetboxvm.upload-progress } | ||
|
||
## License | ||
|
||
MIT |
2 changes: 2 additions & 0 deletions
2
provisioning/roles/thom8.php-upload-progress/defaults/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
workspace: /root |
43 changes: 43 additions & 0 deletions
43
provisioning/roles/thom8.php-upload-progress/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
dependencies: | ||
- geerlingguy.php | ||
|
||
galaxy_info: | ||
author: beetboxvm | ||
description: PHP Upload progress for Linux. | ||
license: "license (BSD, MIT)" | ||
min_ansible_version: 2.0 | ||
platforms: | ||
- name: EL | ||
versions: | ||
- all | ||
- name: GenericUNIX | ||
versions: | ||
- all | ||
- name: Fedora | ||
versions: | ||
- all | ||
- name: opensuse | ||
versions: | ||
- all | ||
- name: GenericBSD | ||
versions: | ||
- all | ||
- name: FreeBSD | ||
versions: | ||
- all | ||
- name: Ubuntu | ||
versions: | ||
- all | ||
- name: SLES | ||
versions: | ||
- all | ||
- name: GenericLinux | ||
versions: | ||
- all | ||
- name: Debian | ||
versions: | ||
- all | ||
categories: | ||
- development | ||
- web |
56 changes: 56 additions & 0 deletions
56
provisioning/roles/thom8.php-upload-progress/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
- name: Include OS-specific variables. | ||
include_vars: "{{ ansible_os_family }}.yml" | ||
|
||
- name: Define php_uploadprogress_module_path. | ||
set_fact: | ||
php_uploadprogress_module_path: "{{ __php_uploadprogress_module_path }}" | ||
when: php_uploadprogress_module_path is not defined | ||
|
||
- name: Define php_uploadprogress_config_filename. | ||
set_fact: | ||
php_uploadprogress_config_filename: "{{ __php_uploadprogress_config_filename }}" | ||
when: php_uploadprogress_config_filename is not defined | ||
|
||
- name: Download and untar uploadprogress. | ||
unarchive: | ||
src: "https://github.com/php/pecl-php-uploadprogress/archive/master.tar.gz" | ||
dest: "{{ workspace }}" | ||
copy: no | ||
creates: "{{ workspace }}/pecl-php-uploadprogress-master" | ||
|
||
- name: Build uploadprogress. | ||
shell: > | ||
{{ item }} | ||
chdir={{ workspace }}/pecl-php-uploadprogress-master | ||
creates={{ workspace }}/pecl-php-uploadprogress-master/modules/uploadprogress.so | ||
with_items: | ||
- phpize | ||
- ./configure | ||
- make | ||
notify: restart webserver | ||
|
||
- name: Ensure uploadprogress module path exists. | ||
file: | ||
path: "{{ php_uploadprogress_module_path }}" | ||
state: directory | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
|
||
- name: Move uploadprogress module into place. | ||
shell: > | ||
cp {{ workspace }}/pecl-php-uploadprogress-master/modules/uploadprogress.so {{ php_uploadprogress_module_path }}/uploadprogress.so | ||
creates={{ php_uploadprogress_module_path }}/uploadprogress.so | ||
notify: restart webserver | ||
|
||
- name: Add php extension config for uploadprogress. | ||
template: | ||
src: uploadprogress.ini.j2 | ||
dest: "{{ item }}/{{ php_uploadprogress_config_filename }}" | ||
owner: root | ||
group: root | ||
force: yes | ||
mode: 0644 | ||
with_items: "{{ php_extension_conf_paths }}" | ||
notify: restart webserver |
2 changes: 2 additions & 0 deletions
2
provisioning/roles/thom8.php-upload-progress/templates/uploadprogress.ini.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
; activate and configurate for php uploadprogress module | ||
extension={{ php_uploadprogress_module_path }}/uploadprogress.so |
30 changes: 30 additions & 0 deletions
30
provisioning/roles/thom8.php-upload-progress/tests/Dockerfile.centos-7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM centos:7 | ||
|
||
# Install systemd -- See https://hub.docker.com/_/centos/ | ||
RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs | ||
RUN yum -y update; yum clean all; \ | ||
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ | ||
rm -f /lib/systemd/system/multi-user.target.wants/*; \ | ||
rm -f /etc/systemd/system/*.wants/*; \ | ||
rm -f /lib/systemd/system/local-fs.target.wants/*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ | ||
rm -f /lib/systemd/system/basic.target.wants/*; \ | ||
rm -f /lib/systemd/system/anaconda.target.wants/*; | ||
|
||
# Install Ansible | ||
RUN yum -y install epel-release | ||
RUN yum -y install git ansible sudo | ||
RUN yum clean all | ||
|
||
RUN yum install -y unzip | ||
RUN yum groupinstall -y "Development Tools" | ||
|
||
# Disable requiretty | ||
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers | ||
|
||
# Install Ansible inventory file | ||
RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts | ||
|
||
VOLUME ["/sys/fs/cgroup"] | ||
CMD ["/usr/sbin/init"] |
13 changes: 13 additions & 0 deletions
13
provisioning/roles/thom8.php-upload-progress/tests/Dockerfile.ubuntu-12.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM ubuntu:12.04 | ||
RUN apt-get update | ||
|
||
# Install Ansible | ||
RUN apt-get install -y software-properties-common python-software-properties git | ||
RUN apt-add-repository -y ppa:ansible/ansible | ||
RUN apt-get update | ||
RUN apt-get install -y ansible | ||
|
||
RUN apt-get install -y unzip | ||
|
||
# Install Ansible inventory file | ||
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts |
13 changes: 13 additions & 0 deletions
13
provisioning/roles/thom8.php-upload-progress/tests/Dockerfile.ubuntu-14.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM ubuntu:14.04 | ||
RUN apt-get update | ||
|
||
# Install Ansible | ||
RUN apt-get install -y software-properties-common git | ||
RUN apt-add-repository -y ppa:ansible/ansible | ||
RUN apt-get update | ||
RUN apt-get install -y ansible | ||
|
||
RUN apt-get install -y unzip | ||
|
||
# Install Ansible inventory file | ||
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
localhost |
20 changes: 20 additions & 0 deletions
20
provisioning/roles/thom8.php-upload-progress/tests/test-source.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- hosts: all | ||
|
||
vars: | ||
php_enable_webserver: false | ||
php_enablerepo: "remi,remi-php70" | ||
|
||
pre_tasks: | ||
- name: Ensure build dependencies are installed (RedHat). | ||
yum: name=which state=present | ||
when: ansible_os_family == 'RedHat' | ||
|
||
- name: Add repository for PHP 7.0. | ||
apt_repository: repo='ppa:ondrej/php' | ||
when: ansible_os_family == 'Debian' | ||
|
||
roles: | ||
- { role: geerlingguy.repo-remi, when: ansible_os_family == 'RedHat' } | ||
- geerlingguy.php | ||
- role_under_test |
20 changes: 20 additions & 0 deletions
20
provisioning/roles/thom8.php-upload-progress/tests/uploadprogress-test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Test if Upload progress is available and working. | ||
*/ | ||
|
||
$success = FALSE; | ||
|
||
// Check uploadprogress extension is loaded. | ||
if (extension_loaded('uploadprogress')) { | ||
$success = TRUE; | ||
print "Upload progress working properly.\r\n"; | ||
exit(0); | ||
} | ||
|
||
if (!$success) { | ||
print "Upload progress not working properly.\r\n"; | ||
exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
__php_uploadprogress_module_path: /usr/lib/php5/modules | ||
__php_uploadprogress_config_filename: 20-uploadprogress.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
__php_uploadprogress_module_path: /usr/lib64/php/modules | ||
__php_uploadprogress_config_filename: uploadprogress.ini |