Skip to content

Instantly share code, notes, and snippets.

View nathenharvey's full-sized avatar

Nathen Harvey nathenharvey

View GitHub Profile
@nathenharvey
nathenharvey / catalina-opts.conf
Last active January 5, 2017 16:10
national-parks lab
{{~#if bind.database}}
{{~#each bind.database.members}}
export CATALINA_OPTS="-DMONGODB_SERVICE_HOST={{address}} -DMONGODB_SERVICE_PORT={{port}}"
{{~/each}}
{{~/if}}
Day Space Time Card Suit
Wednesday 1 2:20 2 Diamonds ♦
Wednesday 1 3:05 3 Diamonds ♦
Wednesday 1 4:05 4 Diamonds ♦
Wednesday 2 2:20 5 Diamonds ♦
Wednesday 2 3:05 6 Diamonds ♦
Wednesday 2 4:05 7 Diamonds ♦
Wednesday 3 2:20 8 Diamonds ♦
Wednesday 3 3:05 9 Diamonds ♦
@nathenharvey
nathenharvey / vhosts.rb
Last active May 31, 2016 16:41
vhosts recipe for one-day Introduction to Chef workshop
data_bag("vhosts").each do |site|
site_data = data_bag_item("vhosts", site)
site_name = site_data["id"]
document_root = "/srv/apache/#{site_name}"
template "/etc/httpd/conf.d/#{site_name}.conf" do
source "custom-vhosts.erb"
mode "0644"
variables(
:document_root => document_root,
@nathenharvey
nathenharvey / fixed_gpgcheck.rb
Created April 27, 2016 20:45
parse_config_file fails when it encounters a '['
options = {
assignment_re: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/,
comment_char: '['
}
# describe parse_config_file('/etc/yum.conf') do
describe parse_config_file('yum.conf', options) do
its('gpgcheck') { should cmp 1 }
end
@nathenharvey
nathenharvey / example.rb
Created April 27, 2016 18:50
InSpec Command and stdout
# encoding: utf-8
# copyright: 2015, The Authors
# license: All rights reserved
title 'File System Configuration'
# you add controls here
control '1.2.1 Verify CentOS GPG Key is Installed' do # A unique ID for this control
impact 1.0 # The criticality, if this control fails.
title 'Verify CentOS GPG Key is Installed' # A human-readable title
{"foo" => "1.0", "bar" => "latest"}.each do |pkg,ver|
if ver == "latest"
yum_package pkg do
action :upgrade
end
else
yum_package pkg do
version ver
action :install
end
default[:vertx][:version] = '2.0.2'
default[:vertx][:home] = '/srv/vertx'
default[:vertx][:url] = 'http://dl.bintray.com/vertx/downloads/'
# cookbooks/users/attributes/default.rb
default["sudo"]["users"] = ["userA", "userB"]
#
# Cookbook Name:: apache
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This is a Vagrant configuration file. It can be used to set up and manage
# virtual machines on your local system or in the cloud. See http://downloads.vagrantup.com/
# for downloads and installation instructions, and see http://docs.vagrantup.com/v2/
# for more information and configuring and using Vagrant.
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,