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,55 @@
---
sudo: required
env:
- distribution: centos
version: 7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distribution: ubuntu
version: 14.04
init: /sbin/init
run_opts: ""
- distribution: ubuntu
version: 12.04
init: /sbin/init
run_opts: ""
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'
# Ansible syntax check.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.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.yml'
# Test role idempotence.
- >
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Ensure Blackfire is installed.
#- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm TODO'
# Clean up
- 'sudo docker stop "$(cat ${container_id})"'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View file

@ -0,0 +1,41 @@
# Ansible Role: Blackfire
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-blackfire.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-blackfire)
Installs [Blackfire](https://blackfire.io/) on RHEL/CentOS or Debian/Ubuntu.
## Requirements
After installation, you need to complete Blackfire setup manually before profiling:
1. Register the Blackfire agent: `sudo blackfire-agent -register`
2. Configure Blackfire: `blackfire config`
## Role Variables
Available variables are listed below, along with default values (see `defaults/main.yml`):
blackfire_packages:
- blackfire-agent
- blackfire-php
The Blackfire packages this role will install on the server. Note that `blackfire-php` may not work well with XHProf and/or XDebug.
## Dependencies
Requires the `geerlingguy.php` role.
## Example Playbook
- hosts: webserver
roles:
- geerlingguy.php
- geerlingguy.blackfire
## License
MIT / BSD
## Author Information
This role was created in 2016 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).

View file

@ -0,0 +1,6 @@
---
blackfire_gpg_key_url: https://packagecloud.io/gpg.key
blackfire_packages:
- blackfire-agent
- blackfire-php

View file

@ -0,0 +1,28 @@
---
dependencies:
- geerlingguy.php
galaxy_info:
author: geerlingguy
description: Blackfire installation for Linux
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.0
platforms:
- name: EL
versions:
- 6
- 7
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- precise
- raring
- saucy
- trusty
- xenial
galaxy_tags:
- development
- web

View file

@ -0,0 +1,14 @@
---
- include: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
- include: setup-Debian.yml
when: ansible_os_family == 'Debian'
- name: Ensure Blackfire packages are installed.
package:
name: "{{ blackfire_packages }}"
state: present
notify:
- restart webserver
- restart php-fpm

View file

@ -0,0 +1,17 @@
---
- name: Add packagecloud apt key.
apt_key:
url: "{{ blackfire_gpg_key_url }}"
state: present
- name: Add packagecloud repository.
apt_repository:
repo: "{{ item }}"
state: present
register: packagecloud_repos
with_items:
- "deb http://packages.blackfire.io/debian any main"
- name: Update apt caches after repo is added.
apt: update_cache=yes
when: packagecloud_repos.changed

View file

@ -0,0 +1,18 @@
---
- name: Add packagecloud GPG key.
rpm_key:
key: "{{ blackfire_gpg_key_url }}"
state: present
- name: Add Blackfire repository.
get_url:
url: http://packages.blackfire.io/fedora/blackfire.repo
dest: /etc/yum.repos.d/blackfire.repo
mode: 0644
- name: Disable gpg_repocheck for non-bleeding-edge CentOS.
lineinfile: >
dest=/etc/yum.repos.d/blackfire.repo
regexp="^repo_gpgcheck="
line="repo_gpgcheck=0"
state=present

View file

@ -0,0 +1,27 @@
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
# 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"]

View file

@ -0,0 +1,11 @@
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
# Install Ansible inventory file
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts

View file

@ -0,0 +1,11 @@
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
# Install Ansible inventory file
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts

View file

@ -0,0 +1,10 @@
---
- hosts: all
vars:
php_enable_webserver: false
php_enable_php_fpm: true
roles:
- geerlingguy.php
- role_under_test