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,4 @@
[clog]
changelog = "CHANGELOG.md"
repository = "https://github.com/weareinteractive/ansible-newrelic"
from-latest-tag = true

View file

@ -0,0 +1,16 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_size = 2
indent_style = space
# We recommend you to keep these unchanged
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View file

@ -0,0 +1,6 @@
.*
*~
!.git*
!.clog.toml
!.travis.yml
!.editorconfig

View file

@ -0,0 +1,10 @@
---
language: ruby
sudo: required
services:
- docker
install:
- docker pull franklinkim/ansible:ubuntu-trusty
script:
- docker run -v $(pwd):/opt/ansible franklinkim/ansible:ubuntu-trusty tests/run.sh

View file

@ -0,0 +1,92 @@
<a name="1.6.0"></a>
## 1.6.0 (2016-11-11)
#### Features
* add `cgroup_style` option to config ([fd806272](https://github.com/weareinteractive/ansible-newrelic/commit/fd80627235dca4c6dad2b4edaa13e3d5ab64174d))
<a name="1.5.0"></a>
## 1.5.0 (2016-11-10)
#### Features
* add proxy options ([d8c80eaa](https://github.com/weareinteractive/ansible-newrelic/commit/d8c80eaac222078c918be6ff80ce94f4d444510b))
<a name="1.4.3"></a>
### 1.4.3 (2016-11-03)
#### Bug Fixes
* fix readme badge url ([a143bf3e](https://github.com/weareinteractive/ansible-newrelic/commit/a143bf3ee48ee07fa3657186763d857d00083b56))
<a name="1.4.2"></a>
### 1.4.2 (2016-09-30)
<a name="1.4.1"></a>
### 1.4.1 (2016-09-20)
#### Bug Fixes
* remove duplicate newrelic_license_key ([036d2777](https://github.com/weareinteractive/ansible-newrelic/commit/036d27779b7db47b9fb06b9a983d759d2ad196bf))
<a name="1.4.0"></a>
## 1.4.0 (2016-08-05)
#### Features
* add label settings ([169d3867](https://github.com/weareinteractive/ansible-newrelic/commit/169d386710aba0d7d1397cb68ef7f8426d1fac80))
<a name="1.3.0"></a>
## 1.3.0 (2016-07-04)
<a name="1.2.1"></a>
### 1.2.1 (2016-04-10)
#### Bug Fixes
* default groups breaks install when docker monitoring is enabled ([3e507b30](https://github.com/weareinteractive/ansible-newrelic/commit/3e507b3080fa8040a3659577f1bdc25c3d97508a))
<a name="1.2.0"></a>
## 1.2.0 (2016-02-13)
#### Breaking Changes
* add configurable `newrelic_group` and `newrelic_groups` ([b06cf9f4](https://github.com/weareinteractive/ansible-newrelic/commit/b06cf9f4bbaeb6edd3bae8b600d351a27dbd28d5), breaks [#](https://github.com/weareinteractive/ansible-newrelic/issues/))
#### Bug Fixes
* make docker container monitoring work ([89986c76](https://github.com/weareinteractive/ansible-newrelic/commit/89986c7649e3bc3d9f08d1d2027596b9e089b6c5))
#### Features
* add configurable `newrelic_group` and `newrelic_groups` ([b06cf9f4](https://github.com/weareinteractive/ansible-newrelic/commit/b06cf9f4bbaeb6edd3bae8b600d351a27dbd28d5), breaks [#](https://github.com/weareinteractive/ansible-newrelic/issues/))
* use ansible-role docgen for README generation ([23b5e65f](https://github.com/weareinteractive/ansible-newrelic/commit/23b5e65fb9fe82851ec450f99d80b7db42663e58))
* add CHANGELOG ([86830e8f](https://github.com/weareinteractive/ansible-newrelic/commit/86830e8f5d84195c2b3c11a8d3b1235a74cb136f))

View file

@ -0,0 +1,22 @@
Copyright (c) We Are Interactive
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,135 @@
# Ansible franklinkim.newrelic role
[![Build Status](https://img.shields.io/travis/weareinteractive/ansible-newrelic.svg)](https://travis-ci.org/weareinteractive/ansible-newrelic)
[![Galaxy](http://img.shields.io/badge/galaxy-franklinkim.newrelic-blue.svg)](https://galaxy.ansible.com/franklinkim/newrelic/)
[![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/ansible-newrelic.svg)](https://github.com/weareinteractive/ansible-newrelic)
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-newrelic.svg)](https://github.com/weareinteractive/ansible-newrelic)
> `franklinkim.newrelic` is an [Ansible](http://www.ansible.com) role which:
>
> * installs newrelic
> * configures newrelic
> * configures service
## Installation
Using `ansible-galaxy`:
```shell
$ ansible-galaxy install franklinkim.newrelic
```
Using `requirements.yml`:
```yaml
- src: franklinkim.newrelic
```
Using `git`:
```shell
$ git clone https://github.com/weareinteractive/ansible-newrelic.git franklinkim.newrelic
```
## Dependencies
* Ansible >= 2.0
## Variables
Here is a list of all the default variables for this role, which are also available in `defaults/main.yml`.
```yaml
---
#
# newrelic_license_key: yourkey
# User name
newrelic_user: newrelic
# User group
newrelic_group: newrelic
# User groups to append to user
newrelic_groups: []
# Name of the file where the server monitor will store it's log messages.
newrelic_logfile: /var/log/newrelic/nrsysmond.log
# Level of detail you want in the log file
newrelic_loglevel: info
# Set to true to disable NFS client statistics gathering.
newrelic_disable_nfs: yes
# Set to true to disable Docker container statistics gathering.
newrelic_disable_docker: yes
# start on boot
newrelic_service_enabled: yes
# current state: started, stopped
newrelic_service_state: started
# use default hostname, set a value to override the default hostname
newrelic_override_hostname: ~
# A series of label_type/label_value pairings: label_type:label_value
newrelic_labels:
# proxy server to use (i.e. proxy-host:8080)
newrelic_proxy:
# Option to fix Docker memory (see: https://discuss.newrelic.com/t/wrong-path-to-cpu-and-memoy-data/36177)
newrelic_cgroup_style:
```
## Handlers
These are the handlers that are defined in `handlers/main.yml`.
```yaml
---
- name: restart newrelic
service:
name: newrelic-sysmond
state: restarted
when: newrelic_service_state != 'stopped'
```
## Usage
This is an example playbook:
```yaml
---
- hosts: all
become: yes
roles:
- franklinkim.newrelic
vars:
newrelic_service_state: started
newrelic_license_key: ab2fa361cd4d0d373833cad619d7bcc424d27c16
```
## Testing
```shell
$ git clone https://github.com/weareinteractive/ansible-newrelic.git
$ cd ansible-newrelic
$ make test
```
## Contributing
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests and examples for any new or changed functionality.
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
*Note: To update the `README.md` file please install and run `ansible-role`:*
```shell
$ gem install ansible-role
$ ansible-role docgen
```
## License
Copyright (c) We Are Interactive under the MIT license.

View file

@ -0,0 +1,23 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vbguest.no_remote = true
config.vbguest.auto_update = false
config.vm.define 'trusty' do |instance|
instance.vm.box = 'ubuntu/trusty64'
end
config.vm.define 'centos7' do |instance|
instance.vm.box = 'geerlingguy/centos7'
end
# View the documentation for the provider you're using for more
# information on available options.
config.vm.provision "ansible" do |ansible|
ansible.playbook = "tests/main.yml"
ansible.verbose = 'vv'
ansible.sudo = true
end
end

View file

@ -0,0 +1,30 @@
---
#
# newrelic_license_key: yourkey
# User name
newrelic_user: newrelic
# User group
newrelic_group: newrelic
# User groups to append to user
newrelic_groups: []
# Name of the file where the server monitor will store it's log messages.
newrelic_logfile: /var/log/newrelic/nrsysmond.log
# Level of detail you want in the log file
newrelic_loglevel: info
# Set to true to disable NFS client statistics gathering.
newrelic_disable_nfs: yes
# Set to true to disable Docker container statistics gathering.
newrelic_disable_docker: yes
# start on boot
newrelic_service_enabled: yes
# current state: started, stopped
newrelic_service_state: started
# use default hostname, set a value to override the default hostname
newrelic_override_hostname: ~
# A series of label_type/label_value pairings: label_type:label_value
newrelic_labels:
# proxy server to use (i.e. proxy-host:8080)
newrelic_proxy:
# Option to fix Docker memory (see: https://discuss.newrelic.com/t/wrong-path-to-cpu-and-memoy-data/36177)
newrelic_cgroup_style:

View file

@ -0,0 +1,7 @@
---
- name: restart newrelic
service:
name: newrelic-sysmond
state: restarted
when: newrelic_service_state != 'stopped'

View file

@ -0,0 +1,142 @@
---
galaxy_info:
author: franklin
company: We Are Interactive
description: Installs and configure newrelic
min_ansible_version: 2.0
license: MIT
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If travis integration is cofigured, only notification for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
github_branch: master
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
platforms:
- name: EL
versions:
- all
# - 5
# - 6
# - 7
#- name: GenericUNIX
# versions:
# - all
# - any
#- name: Solaris
# versions:
# - all
# - 10
# - 11.0
# - 11.1
# - 11.2
# - 11.3
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
# - 23
#- name: Windows
# versions:
# - all
# - 2012R2
#- name: SmartOS
# versions:
# - all
# - any
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
#- name: GenericBSD
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 10.0
# - 10.1
# - 10.2
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
# - 9.3
- name: Ubuntu
versions:
- all
# - lucid
# - maverick
# - natty
# - oneiric
# - precise
# - quantal
# - raring
# - saucy
# - trusty
# - utopic
# - vivid
# - wily
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
#- name: GenericLinux
# versions:
# - all
# - any
- name: Debian
versions:
- all
# - etch
# - jessie
# - lenny
# - squeeze
# - wheezy categories:
#
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
# Users find roles by searching for tags. Be sure to
# remove the '[]' above if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of
# alphanumeric characters. Maximum 20 tags per role.
galaxy_tags:
- monitoring
- newrelic
# List your role dependencies here, one per line. Only
# dependencies available via galaxy should be listed here.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
dependencies: []

View file

@ -0,0 +1,14 @@
---
galaxy_name: franklinkim.newrelic
github_user: weareinteractive
github_name: ansible-newrelic
badges: |
[![Build Status](https://img.shields.io/travis/weareinteractive/ansible-newrelic.svg)](https://travis-ci.org/weareinteractive/ansible-newrelic)
[![Galaxy](http://img.shields.io/badge/galaxy-franklinkim.newrelic-blue.svg)](https://galaxy.ansible.com/franklinkim/newrelic/)
[![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/ansible-newrelic.svg)](https://github.com/weareinteractive/ansible-newrelic)
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-newrelic.svg)](https://github.com/weareinteractive/ansible-newrelic)
description: |
> * installs newrelic
> * configures newrelic
> * configures service

View file

@ -0,0 +1,19 @@
---
- name: Configuring module
template:
src: "{{ item }}.j2"
dest: "/{{ item }}"
owner: "{{ newrelic_user }}"
group: "{{ newrelic_group }}"
mode: "0640"
notify: restart newrelic
with_items:
- "etc/newrelic/nrsysmond.cfg"
- name: Configuring user groups
user:
name: "{{ newrelic_user }}"
groups: "{{ newrelic_groups|join(',') }}"
append: yes
when: not newrelic_disable_docker

View file

@ -0,0 +1,7 @@
---
- include: install_debian.yml
when: ansible_os_family == 'Debian'
- include: install_redhat.yml
when: ansible_os_family == 'RedHat'

View file

@ -0,0 +1,23 @@
---
- name: Installing dependencies
apt:
pkg: apt-transport-https
state: present
- name: Adding APT key
apt_key:
id: 548C16BF
url: https://download.newrelic.com/548C16BF.gpg
- name: Add APT repository
apt_repository:
repo: "deb http://apt.newrelic.com/debian/ newrelic non-free"
update_cache: yes
- name: Installing packages
apt:
pkg: "{{ item }}"
state: present
with_items:
- newrelic-sysmond

View file

@ -0,0 +1,13 @@
---
- name: Installing dependencies
yum:
name: http://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm
state: present
- name: Installing packages
yum:
name: "{{ item }}"
state: present
with_items:
- newrelic-sysmond

View file

@ -0,0 +1,28 @@
---
- name: Checking for key
fail:
msg: "newrelic_license_key has not been defined"
when: newrelic_license_key|default(False) == False
- include: install.yml
tags:
- monitoring
- newrelic
- install
- newrelic-install
- include: config.yml
tags:
- monitoring
- newrelic
- config
- newrelic-config
- include: service.yml
tags:
- monitoring
- newrelic
- service
- newrelic-service

View file

@ -0,0 +1,7 @@
---
- name: Configuring service
service:
name: newrelic-sysmond
state: "{{ newrelic_service_state }}"
enabled: "{{ newrelic_service_enabled }}"

View file

@ -0,0 +1,235 @@
# {{ ansible_managed }}
#
# New Relic Server Monitor configuration file.
#
# Lines that begin with a # are comment lines and are ignored by the server
# monitor. For those options that have command line equivalents, if the
# option is specified on the command line it will over-ride any value set
# in this file.
#
#
# Option : cgroup_style
# Value : 0
# Note : Setting `cgroup_style=0` fixes issue with docker memory reporting
# Workaround for an issue where new relic cannot get container memory stats.
# http://stackoverflow.com/questions/36788770/newrelic-does-not-display-cpu-memory-usage-for-dockers-container
# Default: none
#
#cgroup_style=
{% if newrelic_cgroup_style|default(None) != None %}
cgroup_style={{ newrelic_cgroup_style }}
{% endif %}
#
# Option : license_key
# Value : 40-character hexadecimal string provided by New Relic. This is
# required in order for the server monitor to start.
# Default: none
#
license_key={{ newrelic_license_key }}
#
# Option : loglevel
# Value : Level of detail you want in the log file (as defined by the logfile
# setting below. Valid values are (in increasing levels of verbosity):
# error - show errors only
# warning - show errors and warnings
# info - show minimal additional information messages
# verbose - show more detailed information messages
# debug - show debug messages
# verbosedebug - show very detailed debug messages
# Default: error
# Note : Can also be set with the -d command line option.
#
loglevel={{ newrelic_loglevel }}
#
# Option : logfile
# Value : Name of the file where the server monitor will store it's log
# messages. The amount of detail stored in this file is controlled
# by the loglevel option (above).
# Default: none. However it is highly recommended you set a value for this.
# Note : Can also be set with the -l command line option.
#
logfile={{ newrelic_logfile }}
#
# Option : proxy
# Value : The name and optional login credentials of the proxy server to use
# for all communication with the New Relic collector. In its simplest
# form this setting is just a hostname[:port] setting. The default
# port if none is specified is 1080. If your proxy requires a user
# name, use the syntax user@host[:port]. If it also requires a
# password use the format user:password@host[:port]. For example:
# fred:secret@proxy.mydomain.com:8181
# Default: none (use a direct connection)
#
#proxy=
{% if newrelic_proxy|default(None) != None %}
proxy={{ newrelic_proxy }}
{% endif %}
#
# Setting: ssl
# Type : boolean
# Purpose: If you prefer the daemon to use the secure HTTP (https) protocol
# when communicating with the New Relic collector servers, set this
# to true.
# Default: true (as of version 1.4)
#
#ssl=true
#
# Setting: docker_connection
# Type : string
# Purpose: Determine how to communicate with the Docker API on the local host.
# Valid values are:
#
# uds:///path/to/socket
# unix:///path/to/socket
# /path/to/socket
# These three forms are all equivalent and are used to point to the
# UNIX-domain socket (UDS). The socket path must be absolute and the
# socket must be writeable.
#
# tcp://localhost:port
# http://localhost:port
# Use an unencrypted connection to the local host on the specified
# port. If the :port portion is missing it defaults to 2376. The
# host name MUST be localhost or 127.0.0.1. No other host name is
# valid.
#
# https://localhost:port
# Use an encrypted connection to the local host om the specified
# port. If the :port portion is missing it defaults to 2376. The
# host name MUST be localhost or 127.0.0.1. No other host name is
# valid. In order to use TLS authentication you may need to set
# the various key and certificate options below.
#
# If no value is set, attempt to use the default (/var/run/docker.sock)
# if it exists and is writable. If that fails, attempt to use the value
# of the environment variable DOCKER_HOST.
#
# You may need to add the user that you run LSM as to the docker
# group. Please consult the Docker web site for details and security
# implications.
# Default: empty
#docker_connection=
#
# Setting: docker_cert_path
# Type : string
# Purpose: Set the default location to look for the certificate, key and CA
# certificate for using TLS. If no value is set and the directory
# $HOME/.docker exists, that is used as the default value. LSM will
# look in this directory for the cert.pem, key.pem and cacert.pem
# files, and use them if present. If set, the environment variable
# $DOCKER_CERT_PATH will be used as the default value if no value
# is explicitly set here.
# Default: empty
#docker_cert_path=
#
# Setting: docker_cert
# docker_key
# docker_cacert
# Type : string
# Purpose: Set the name of the certificate, key and CA certificate files to
# use for TLS. If these are not absolute paths they are searched for
# in the directory determined by docker_cert_path above.
# Default: empty
#docker_cert=
#docker_key=
#docker_cacert=
#
# Setting: ssl_ca_bundle
# Type : string
# Purpose: Sets the location of a file containing CA certificates in PEM
# format. When set, the certificates in this file will be used
# to authenticate the New Relic collector servers. If ssl_ca_path
# is also set (see below), the certificates in this file will be
# searched first, followed by the certificates contained in the
# ssl_ca_path directory. This setting has no effect when ssl
# is set to false.
# Default: none
# Note : Can also be set with the -b command line option.
#
#ssl_ca_bundle=
#
# Setting: ssl_ca_path
# Type : string
# Purpose: Sets the location of a directory containing trusted CA certificates
# in PEM format. When set, the certificates in this directory will be
# used to authenticate the New Relic collector servers. If
# ssl_ca_bundle is also set (see above), it will be searched first
# followed by the certificates contained in ssl_ca_path. This
# setting has no effect when ssl is set to false.
# Default: none
# Note : Can also be set with the -S command line option.
#
#ssl_ca_path=
#
# Option : pidfile
# Value : Name of a file where the server monitoring daemon will store it's
# process ID (PID). This is used by the startup and shutdown script
# to determine if the monitor is already running, and to start it up
# or shut it down.
# Default: /tmp/nrsysmond.pid
# Note : Can also be set with the -p command line option.
#
#pidfile=/var/run/newrelic/nrsysmond.pid
# Option : collector_host
# Value : The name of the New Relic collector to connect to. This should only
# ever be changed on advise from a New Relic support staff member.
# The format is host[:port]. Using a port number of 0 means the default
# port, which is 80 (if not using the ssl option - see below) or 443
# if SSL is enabled. If the port is omitted the default value is used.
# Default: collector.newrelic.com
#
#collector_host=collector.newrelic.com
#
# Option : labels
# Value : A series of label_type/label_value pairings
# Each item in the pair is separated by a colon
# Each pair is separated by a semicolon
# e.g.
# labels = Environment:Production;DataCenter:EastUS;
# Default: none
#
#labels=label_type:label_value
{% if newrelic_labels|default(None) != None %}
labels={{ newrelic_labels }}
{% endif %}
#
# Option : disable_nfs
# Type : boolean
# Value : Set to true to disable NFS client statistics gathering.
# Default: false
#
disable_nfs={{ newrelic_disable_nfs | to_nice_json }}
#
# Option : disable_docker
# Type : boolean
# Value : Set to true to disable Docker container statistics gathering.
# Default: false
#
disable_docker={{ newrelic_disable_docker | to_nice_json }}
#
# Option : override_hostname
# Type : string
# Value : Set to a non-empty value to use as the hostname that will be reported to New Relic
# Default: none
#
#hostname=newrelic.com
{% if newrelic_override_hostname|default(None) != None %}
hostname={{ newrelic_override_hostname }}
{% endif %}

View file

@ -0,0 +1,9 @@
---
- hosts: all
become: yes
roles:
- franklinkim.newrelic
vars:
newrelic_service_state: started
newrelic_license_key: ab2fa361cd4d0d373833cad619d7bcc424d27c16

View file

@ -0,0 +1,17 @@
#!/bin/bash
# define variables
ROLE_NAME=franklinkim.newrelic
# install dependencies
# echo '* installing dependencies'
# ansible-galaxy install franklinkim.openssl
# create role symlink
echo '* creating symlink'
ln -s $(pwd) /usr/share/ansible/roles/$ROLE_NAME
# run tests
echo 'running playbook'
ansible-playbook --syntax-check -i 'localhost,' -c local $(pwd)/tests/main.yml
ansible-playbook -vvvv -i 'localhost,' -c local $(pwd)/tests/main.yml