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,2 @@
*.retry
tests/test.sh

View file

@ -0,0 +1,67 @@
---
services: docker
env:
# Package install on all OSes.
- distro: centos7
playbook: test.yml
ruby_version: 2.0.0
ruby_path_prefix: /usr
- distro: ubuntu1604
playbook: test.yml
ruby_version: 2.3.1
ruby_path_prefix: /usr
- distro: ubuntu1404
playbook: test.yml
ruby_version: 1.9.3
ruby_path_prefix: /usr
- distro: debian8
playbook: test.yml
ruby_version: 2.1.5
ruby_path_prefix: /usr
# Source install on latest OSes.
- distro: centos7
playbook: test-source.yml
ruby_version: 2.3.0
ruby_path_prefix: /usr/local
- distro: ubuntu1604
playbook: test-source.yml
ruby_version: 2.3.0
ruby_path_prefix: /usr/local
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
# Make sure ruby is installed and at the correct version.
- 'docker exec --tty ${container_id} env TERM=xterm which ruby'
- 'docker exec --tty ${container_id} env TERM=xterm test -x ${ruby_path_prefix}/bin/ruby'
- 'docker exec --tty ${container_id} env TERM=xterm ruby --version'
- 'docker exec --tty ${container_id} env TERM=xterm ${ruby_path_prefix}/bin/ruby --version | grep -qF ${ruby_version}'
# Make sure bundler is installed.
- 'docker exec --tty ${container_id} env TERM=xterm ls -lah /usr/local/bin'
- 'docker exec --tty ${container_id} env TERM=xterm which bundle'
# Make sure user installed gems are available.
- |
if [ "${distro}" != "ubuntu1404" ]; then
docker exec --tty ${container_id} env TERM=xterm bash --login -c "which sass"
fi
after_failure:
- 'docker exec --tty ${container_id} env TERM=xterm which ruby'
- 'docker exec --tty ${container_id} env TERM=xterm ruby --version'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View file

@ -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.

View file

@ -0,0 +1,63 @@
# Ansible Role: Ruby
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-ruby.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-ruby)
Installs Ruby and bundler gem on Linux.
## Requirements
None.
## Role Variables
Available variables are listed below, along with default values (see `defaults/main.yml`):
workspace: /root
The location where temporary files will be downloaded in preparation for Ruby installation.
ruby_install_bundler: true
Whether this role should install [Bundler](http://bundler.io/).
ruby_install_gems: []
A list of Ruby gems to install (just the name of the gem to be installed). This is meant as a simple convenience, and will only install the latest version of the gem. If you need to install gems with more options or specificity, you can do so elsewhere in your playbook.
ruby_install_gems_user: username
The user account under which Ruby gems will be installed. Defaults to the `ansible_ssh_user` if not set.
ruby_install_from_source: false
By default, this role will install whatever version of ruby is available through your system's package manager (`apt` or `yum`). You can install whatever version you like (including the latest release) by setting this to `true` and/or updating the `ruby_download_url` and `ruby_version`.
ruby_download_url: http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.gz
The URL from which Ruby will be downloaded (only used if `ruby_install_from_source` is `true`).
ruby_version: 2.2.1
The version of ruby that will be installed (only used if `ruby_install_from_source` is `true`).
ruby_rubygems_package_name: rubygems
The name of the `rubygems` package. Generally, the default should work; but it will be set to `rubygems-integration` automatically on Ubuntu Trusty (14.04).
## Dependencies
None.
## Example Playbook
- hosts: server
roles:
- { role: geerlingguy.ruby }
## License
MIT / BSD
## Author Information
This role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).

View file

@ -0,0 +1,20 @@
---
workspace: /root
# Whether this role should install Bundler.
ruby_install_bundler: true
# A list of Ruby gems to install.
ruby_install_gems: []
# The user account under which Ruby gems will be installed.
ruby_install_gems_user: "{{ ansible_user }}"
# If set to TRUE, ruby will be installed from source, using the version set with
# the 'ruby_version' variable instead of using a package.
ruby_install_from_source: false
ruby_download_url: http://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz
ruby_version: 2.4.1
# Default should usually work, but this will be overridden on Ubuntu 14.04.
ruby_rubygems_package_name: rubygems

View file

@ -0,0 +1,3 @@
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi

View file

@ -0,0 +1,45 @@
---
dependencies: []
galaxy_info:
author: geerlingguy
description: Ruby installation for Linux.
company: "Midwestern Mac, LLC"
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:
- lucid
- trusty
- precise
- name: SLES
versions:
- all
- name: GenericLinux
versions:
- all
- name: Debian
versions:
- all
galaxy_tags:
- development
- web

View file

@ -0,0 +1,62 @@
---
- name: Install packages required to build ruby (RedHat).
yum: "name={{ item }} state=present"
with_items:
- '@development'
- zlib-devel
- openssl-static
when: ansible_os_family == 'RedHat'
- name: Update apt cache (Debian).
apt: update_cache=yes cache_valid_time=86400
when: ansible_os_family == 'Debian'
- name: Install packages required to build ruby (Debian).
apt: "name={{ item }} state=present"
with_items:
- build-essential
- zlib1g-dev
- libssl-dev
- libyaml-dev
- libreadline6-dev
- zlib1g-dev
- libncurses5-dev
- libffi-dev
- libgdbm3
- libgdbm-dev
when: ansible_os_family == 'Debian'
- name: Download ruby.
get_url:
url: "{{ ruby_download_url }}"
dest: "{{ workspace }}/ruby-{{ ruby_version }}.tar.gz"
- name: Extract ruby.
unarchive:
src: "{{ workspace }}/ruby-{{ ruby_version }}.tar.gz"
dest: "{{ workspace }}/"
copy: no
- name: Build ruby.
command: >
{{ item }}
chdir={{ workspace }}/ruby-{{ ruby_version }}
creates=/usr/local/bin/ruby
with_items:
- ./configure --enable-shared
- make
- make install
- name: Add ruby symlinks.
file:
src: "/usr/local/bin/{{ item }}"
dest: "/usr/bin/{{ item }}"
state: link
force: yes
with_items:
- erb
- gem
- irb
- rake
- rdoc
- ruby

View file

@ -0,0 +1,34 @@
---
# Include OS-specific installation tasks.
- include: setup-RedHat.yml
when:
- ruby_install_from_source == False
- ansible_os_family == 'RedHat'
- include: setup-Debian.yml
when:
- ruby_install_from_source == False
- ansible_os_family == 'Debian'
# Install ruby from source when ruby_install_from_source is true.
- include: install-from-source.yml
when: ruby_install_from_source == True
- name: Add user installed RubyGems bin directory to global $PATH.
copy:
src: rubygems.sh
dest: /etc/profile.d/rubygems.sh
mode: 0644
# Install Bundler and configured gems.
- name: Install Bundler.
gem: name=bundler state=present user_install=no
when: ruby_install_bundler
- name: Install configured gems.
gem:
name: "{{ item }}"
state: present
become: yes
become_user: "{{ ruby_install_gems_user }}"
with_items: "{{ ruby_install_gems }}"

View file

@ -0,0 +1,16 @@
---
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=86400
- name: Set rubygems package name for Ubuntu 14.04.
set_fact:
ruby_rubygems_package_name: rubygems-integration
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'
- name: Install ruby, rubygems, and build-essential.
apt: "name={{ item }} state=present"
with_items:
- ruby-full
- ruby-dev
- "{{ ruby_rubygems_package_name }}"
- build-essential

View file

@ -0,0 +1,8 @@
---
- name: Install ruby, rubygems, and development tools.
yum: "name={{ item }} state=present"
with_items:
- ruby
- ruby-devel
- "{{ ruby_rubygems_package_name }}"
- '@development'

View file

@ -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)`

View file

@ -0,0 +1,18 @@
---
- hosts: all
vars:
ruby_install_from_source: true
ruby_download_url: http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz
ruby_version: 2.3.0
ruby_install_gems_user: root
ruby_install_gems:
- sass
pre_tasks:
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian'
roles:
- role_under_test

View file

@ -0,0 +1,28 @@
---
- hosts: all
vars:
ruby_install_gems_user: root
ruby_install_gems:
- sass
ruby_gems_bin_path: /root/.gem/ruby/bin
pre_tasks:
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian'
- name: Use different gems for older OSes (Ubuntu 14.04).
set_fact:
ruby_install_gems: ['json']
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_version == '14.04'
- name: Add rubygems bin dir to system-wide $PATH.
copy:
dest: /etc/profile.d/ruby.sh
content: 'PATH=$PATH:{{ ruby_gems_bin_path }}'
roles:
- role_under_test