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,33 @@
---
services: docker
env:
- distro: centos7
redis_daemon: redis
# - distro: fedora24
# redis_daemon: redis
- distro: ubuntu1604
redis_daemon: redis-server
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 Redis is running, and can be stopped and started cleanly.
- 'docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status ${redis_daemon}'
- 'docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager stop ${redis_daemon}'
- 'docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager start ${redis_daemon}'
after_failure:
- 'docker exec --tty ${container_id} env TERM=xterm cat /var/log/redis/redis-server.log'
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,119 @@
# Ansible Role: Redis
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-redis.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-redis)
Installs [Redis](http://redis.io/) on RHEL/CentOS or Debian/Ubuntu.
## Requirements
On RedHat-based distributions, requires the EPEL repository (you can simply add the role `geerlingguy.repo-epel` to install ensure EPEL is available).
## Role Variables
redis_enablerepo: epel
(Used only on RHEL/CentOS) The repository to use for Redis installation.
Available variables are listed below, along with default values (see `defaults/main.yml`):
redis_port: 6379
redis_bind_interface: 127.0.0.1
Port and interface on which Redis will listen. Set the interface to `0.0.0.0` to listen on all interfaces.
redis_unixsocket: ''
If set, Redis will also listen on a local Unix socket.
redis_timeout: 300
Close a connection after a client is idle `N` seconds. Set to `0` to disable timeout.
redis_loglevel: "notice"
redis_logfile: /var/log/redis/redis-server.log
Log level and log location (valid levels are `debug`, `verbose`, `notice`, and `warning`).
redis_databases: 16
The number of Redis databases.
# Set to an empty set to disable persistence (saving the DB to disk).
redis_save:
- 900 1
- 300 10
- 60 10000
Snapshotting configuration; setting values in this list will save the database to disk if the given number of seconds (e.g. `900`) and the given number of write operations (e.g. `1`) have occurred.
redis_rdbcompression: "yes"
redis_dbfilename: dump.rdb
redis_dbdir: /var/lib/redis
Database compression and location configuration.
redis_maxmemory: 0
Limit memory usage to the specified amount of bytes. Leave at 0 for unlimited.
redis_maxmemory_policy: "noeviction"
The method to use to keep memory usage below the limit, if specified. See [Using Redis as an LRU cache](http://redis.io/topics/lru-cache).
redis_maxmemory_samples: 5
Number of samples to use to approximate LRU. See [Using Redis as an LRU cache](http://redis.io/topics/lru-cache).
redis_appendonly: "no"
The appendonly option, if enabled, affords better data durability guarantees, at the cost of slightly slower performance.
redis_appendfsync: "everysec"
Valid values are `always` (slower, safest), `everysec` (happy medium), or `no` (let the filesystem flush data when it wants, most risky).
# Add extra include files for local configuration/overrides.
redis_includes: []
Add extra include file paths to this list to include more/localized Redis configuration.
The redis package name for installation via the system package manager. Defaults to `redis-server` on Debian and `redis` on RHEL.
redis_package_name: "redis-server"
(Default for RHEL shown) The redis package name for installation via the system package manager. Defaults to `redis-server` on Debian and `redis` on RHEL.
redis_requirepass: ""
Set a password to require authentication to Redis. You can generate a strong password using `echo "my_password_here" | sha256sum`.
redis_disabled_commands: []
For extra security, you can disable certain Redis commands (this is especially important if Redis is publicly accessible). For example:
redis_disabled_commands:
- FLUSHDB
- FLUSHALL
- KEYS
- PEXPIRE
- DEL
- CONFIG
- SHUTDOWN
## Dependencies
None.
## Example Playbook
- hosts: all
roles:
- { role: geerlingguy.redis }
## 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,53 @@
---
# Used for RHEL/CentOS/Fedora only. Allows the use of different repos.
redis_enablerepo: epel
redis_port: 6379
redis_bind_interface: 127.0.0.1
redis_unixsocket: ''
redis_timeout: 300
redis_loglevel: "notice"
redis_logfile: /var/log/redis/redis-server.log
redis_databases: 16
# Set to an empty set to disable persistence (saving the DB to disk).
redis_save:
- 900 1
- 300 10
- 60 10000
redis_rdbcompression: "yes"
redis_dbfilename: dump.rdb
redis_dbdir: /var/lib/redis
redis_maxmemory: 0
redis_maxmemory_policy: "noeviction"
redis_maxmemory_samples: 5
redis_appendonly: "no"
redis_appendfsync: "everysec"
# Add extra include files for local configuration/overrides.
redis_includes: []
# Require authentication to Redis with a password.
redis_requirepass: ""
# Disable certain Redis commands for security reasons.
redis_disabled_commands: []
# - FLUSHDB
# - FLUSHALL
# - KEYS
# - PEXPIRE
# - DEL
# - CONFIG
# - SHUTDOWN
# - BGREWRITEAOF
# - BGSAVE
# - SAVE
# - SPOP
# - SREM
# - RENAME
# - DEBUG

View file

@ -0,0 +1,3 @@
---
- name: restart redis
service: "name={{ redis_daemon }} state=restarted"

View file

@ -0,0 +1,30 @@
---
dependencies: []
galaxy_info:
author: geerlingguy
description: Redis for Linux
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.0
platforms:
- name: EL
versions:
- 6
- 7
- name: Fedora
versions:
- all
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- all
- name: Archlinux
versions:
- all
galaxy_tags:
- database
- development
- web

View file

@ -0,0 +1,29 @@
---
# Variable setup.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Define redis_package.
set_fact:
redis_package: "{{ __redis_package }}"
when: redis_package is not defined
# Setup/install tasks.
- include: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
- include: setup-Debian.yml
when: ansible_os_family == 'Debian'
- include: setup-Archlinux.yml
when: ansible_os_family == 'Archlinux'
- name: Ensure Redis is configured.
template:
src: redis.conf.j2
dest: "{{ redis_conf_path }}"
mode: 0644
notify: restart redis
- name: Ensure Redis is running and enabled on boot.
service: "name={{ redis_daemon }} state=started enabled=yes"

View file

@ -0,0 +1,5 @@
---
- name: Ensure Redis is installed.
pacman:
name: "{{ redis_package }}"
state: present

View file

@ -0,0 +1,5 @@
---
- name: Ensure Redis is installed.
apt:
name: "{{ redis_package }}"
state: present

View file

@ -0,0 +1,6 @@
---
- name: Ensure Redis is installed.
package:
name: "{{ redis_package }}"
state: present
enablerepo: "{{ redis_enablerepo }}"

View file

@ -0,0 +1,55 @@
# {{ ansible_managed }}
daemonize yes
pidfile /var/run/redis/{{ redis_daemon }}.pid
port {{ redis_port }}
bind {{ redis_bind_interface }}
{% if redis_unixsocket %}
unixsocket {{ redis_unixsocket }}
{% endif %}
timeout {{ redis_timeout }}
loglevel {{ redis_loglevel }}
logfile {{ redis_logfile }}
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
# syslog-enabled no
# syslog-ident redis
# syslog-facility local0
databases {{ redis_databases }}
{% for save in redis_save %}
save {{ save }}
{% endfor %}
rdbcompression {{ redis_rdbcompression }}
dbfilename {{ redis_dbfilename }}
dir {{ redis_dbdir }}
# maxclients 128
{% if redis_maxmemory %}
maxmemory {{ redis_maxmemory }}
maxmemory-policy {{ redis_maxmemory_policy }}
maxmemory-samples {{ redis_maxmemory_samples }}
{% endif %}
appendonly {{ redis_appendonly }}
appendfsync {{ redis_appendfsync }}
no-appendfsync-on-rewrite no
{% for include in redis_includes %}
include {{ include }}
{% endfor %}
{% if redis_requirepass %}
requirepass {{ redis_requirepass }}
{% endif %}
{% for redis_disabled_command in redis_disabled_commands %}
rename-command {{ redis_disabled_command }} ""
{% endfor %}

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,15 @@
---
- hosts: all
pre_tasks:
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian'
- name: Clear out repo for Fedora.
set_fact:
redis_enablerepo: ""
when: ansible_distribution == 'Fedora'
roles:
- role_under_test

View file

@ -0,0 +1,4 @@
---
__redis_package: redis
redis_daemon: redis
redis_conf_path: /etc/redis.conf

View file

@ -0,0 +1,4 @@
---
__redis_package: redis-server
redis_daemon: redis-server
redis_conf_path: /etc/redis/redis.conf

View file

@ -0,0 +1,4 @@
---
__redis_package: redis
redis_daemon: redis
redis_conf_path: /etc/redis.conf