Add all files needed to bring up VM and run agaric.com locally

This commit is contained in:
benjamin melançon 2018-08-20 10:45:20 -04:00
parent 52c8b60bac
commit 4d2bc0ee24
742 changed files with 24037 additions and 0 deletions

View file

@ -0,0 +1,43 @@
---
services: docker
env:
- distro: centos7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distro: ubuntu1604
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
before_install:
# Pull container.
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
script:
- container_id=$(mktemp)
# Run container in detached state.
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
# Install dependencies.
- 'docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/role_under_test/tests/requirements.yml'
# Ansible syntax check.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
# Test role.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
# Test role idempotence.
- idempotence=$(mktemp)
- docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
- >
tail ${idempotence}
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Run script to test if Memcached is available and working.
- 'docker exec "$(cat ${container_id})" env TERM=xterm php /etc/ansible/roles/role_under_test/tests/redis-test.php'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View file

@ -0,0 +1,63 @@
# Ansible Role: PhpRedis
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-php-redis.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-php-redis)
Installs PhpRedis support on Linux.
## Requirements
This role doesn't *explicitly* require Redis to be installed, but if you don't have the daemon running somewhere (either on the same server, or somewhere else), this role won't be all that helpful. Check out `geerlingguy.redis` for a simple role to install and configure Redis (either on the same server, or separate servers).
## Role Variables
Available variables are listed below, along with default values (see `defaults/main.yml`):
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 from Remi's repository.
php_redis_package: php-redis
(Default for Debian/Ubuntu shown). If installing from apt or yum, which package to install which provides the PhpRedis extension. (For PHP 5.x on Debian, this should be `php5-redis`).
### Install from source
If you want to install PhpRedis directly from source (if you're on an OS that doesn't have it available as a package, or if you want a newer version than is available through your package manager), you can use the variables below to configure the source installation:
php_redis_install_from_source: false
Whether to install PhpRedis from source. If you'd like to install a specific version of PhpRedis not available via the system package manager, you can compile the extension from source.
php_redis_source_repo: https://github.com/phpredis/phpredis.git
The git repository for the PhpRedis extension.
php_redis_source_version: develop
The branch, tag, or commit hash to use when cloning the source repository. Can be a branch (e.g. `develop` or `php7`), a tag (e.g. `2.2.7`), or a commit hash (e.g. `5241a5c`).
php_redis_source_clone_dir: ~/phpredis
The location where the PhpRedis source code will be cloned locally.
php_redis_source_configure_command: "./configure"
The command to configure a PhpRedis source install. You can modify this command if you want to do something like add `--enable-redis-igbinary`.
## Dependencies
- geerlingguy.php
## Example Playbook
- hosts: webservers
roles:
- { role: geerlingguy.php-redis }
## License
MIT / BSD
## Author Information
This role was created in 2015 by [Jeff Geerling](http://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).

View file

@ -0,0 +1,10 @@
---
# Pass in a comma-separated list of repos to use (e.g. "remi,epel").
php_enablerepo: ""
# Whether to install the extension from source or from an apt or yum repo.
php_redis_install_from_source: false
php_redis_source_repo: https://github.com/phpredis/phpredis.git
php_redis_source_version: develop
php_redis_source_clone_dir: ~/phpredis
php_redis_source_configure_command: "./configure"

View file

@ -0,0 +1 @@
extension=redis.so

View file

@ -0,0 +1,24 @@
---
dependencies:
- geerlingguy.php
galaxy_info:
author: geerlingguy
description: PhpRedis support for Linux
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 1.8
platforms:
- name: EL
versions:
- 6
- 7
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- all
galaxy_tags:
- database
- web

View file

@ -0,0 +1,36 @@
---
- name: Clone the PhpRedis repo.
git:
repo: "{{ php_redis_source_repo }}"
dest: "{{ php_redis_source_clone_dir }}"
version: "{{ php_redis_source_version }}"
accept_hostkey: yes
depth: 1
- name: Run phpize.
shell: >
phpize
chdir={{ php_redis_source_clone_dir }}
creates={{ php_extension_conf_paths[0] }}/redis.ini
- name: Run configure script.
shell: >
{{ php_redis_source_configure_command }}
chdir={{ php_redis_source_clone_dir }}
creates={{ php_extension_conf_paths[0] }}/redis.ini
- name: Make and install PHP.
shell: >
{{ item }}
chdir={{ php_redis_source_clone_dir }}
creates={{ php_extension_conf_paths[0] }}/redis.ini
with_items:
- make
- make install
- name: Ensure the Redis extension is present in PHP's configuration.
copy:
src: redis.ini
dest: "{{ php_extension_conf_paths[0] }}/redis.ini"
mode: 0644
notify: restart webserver

View file

@ -0,0 +1,31 @@
---
# Include variables and define needed variables.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Define php_redis_package.
set_fact:
php_redis_package: "{{ __php_redis_package }}"
when: php_redis_package is not defined
# Install PhpRedis from the system package manager.
- name: Install PhpRedis extension (RedHat).
yum:
name: "{{ php_redis_package }}"
state: installed
enablerepo: "{{ php_enablerepo }}"
notify:
- restart webserver
- restart php-fpm
when: (php_redis_install_from_source == false) and (ansible_os_family == 'RedHat')
- name: Install PhpRedis extension (Debian).
apt: "name={{ php_redis_package }} state=installed"
notify:
- restart webserver
- restart php-fpm
when: (php_redis_install_from_source == false) and (ansible_os_family == 'Debian')
# Install PhpRedis from source.
- include: install-from-source.yml
when: php_redis_install_from_source == true

View file

@ -0,0 +1,32 @@
<?php
/**
* @file
* Test if Redis is available and working.
*/
$success = FALSE;
$key = 'test';
$value = 'Success';
if (class_exists('Redis')) {
$redis = new Redis;
$redis->connect('127.0.0.1', 6379);
// Test adding a value to redis.
if ($redis->set($key, $value)) {
$result = $redis->get($key);
// If we get the expected result, it was a success.
if ($result == $value) {
$success = TRUE;
print "Redis connection successful.\r\n";
exit(0);
}
}
}
if (!$success) {
print "Redis not working properly.\r\n";
exit(1);
}

View file

@ -0,0 +1,4 @@
---
- src: geerlingguy.repo-remi
- src: geerlingguy.redis
- src: geerlingguy.php

View file

@ -0,0 +1,18 @@
---
- hosts: all
vars:
php_enable_webserver: false
php_enablerepo: "remi,remi-php70"
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'
- geerlingguy.redis
- geerlingguy.php
- role_under_test

View file

@ -0,0 +1,2 @@
---
__php_redis_package: php-redis

View file

@ -0,0 +1,2 @@
---
__php_redis_package: php-pecl-redis