Skip to content

Instantly share code, notes, and snippets.

@smford22
smford22 / main.tf
Created May 21, 2018 19:15
terraform GCP remote exec
/*
This is a test server definition for GCE+Terraform for GH-9564
*/
provider "google" {
project = "${var.project}" // Your project ID here.
region = "${var.region}"
}
resource "google_compute_firewall" "gh-9564-firewall-externalssh" {
@smford22
smford22 / user_data.txt
Created April 10, 2018 14:20
Windows User Data
<powershell>
# Turn on WinRM, make sure to relax its security a bit.
# Please don't expose the WinRM port to the world on these machines.
# I am not responsible for anything that happens if you do.
winrm qc -q
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
# Make sure to trust all hosts
Set-Item wsman:localhost\client\trustedhosts -value * -force
@smford22
smford22 / docker-compose.yml
Created February 23, 2018 02:45
national-parks docker-compose.yml
version: '2'
services:
mongodb:
image: <your origin>/np-mongodb
command: --strategy at-once
national-parks:
image: <your origin>/national-parks
ports:
- 8081:8080
- 9631:9631
@smford22
smford22 / osx_audit.rb
Created August 31, 2017 07:20
osx audit role
name 'osx_audit'
description 'A base role to be applied to all mac endpoints'
run_list 'recipe[audit::default]'
default_attributes({
'audit' => {
'reporter' => "chef-automate",
'fetcher' => 'chef-automate',
'profiles' => [
{
'name' => 'osx_baseline',
@smford22
smford22 / kitchen.yml.md
Created August 31, 2017 07:14
Chef Endpoints Workshop .kitchen.yml
---
driver:
  name: vagrant
  vm_hostname: <YOUR_NAME>
  customize:
    memory: 2048
    cpus: 2

provisioner:
@smford22
smford22 / kitchen.ec2.yml.md
Created June 28, 2017 09:39
Example Kitchen EC2
---
driver:
  name: ec2
  aws_ssh_key_id:  <%= ENV['AWS_SSH_KEY_ID'] %>
  region: <%= ENV['AWS_REGION'] %>
  instance_type: m3.medium
  associate_public_ip: true

transport:
@smford22
smford22 / kitchen_configs.md
Created June 28, 2017 03:49
Specifying Alternate kitchen.yml configs via environment variables

It is possible to specify alternate test kitchen configs via environment variables. Why would you want to do this you ask??? This is useful because it allows you to have multiple kitchen configs for different cloud providers like .kitchen.ec2.yml, .kitchen.azure.yml, .kitchen.vagrant.yml, etc.

The ENV variables are:

KITCHEN_YAML="./.kitchen.yml"
KITCHEN_LOCAL_YAML="./.kitchen.local.yml"
KITCHEN_GLOBAL_YAML="$HOME/.kitchen/config.yml"
@smford22
smford22 / kitchen.yml
Last active October 4, 2017 14:41
ec2 kitchen.yml
---
driver:
name: ec2
aws_ssh_key_id: chef_demo_2x
region: us-west-2
security_group_ids: sg-2560a741
associate_public_ip: true
instance_type: t2.micro
tags:
# Replace YOURNAME and YOURCOMPANY here
@smford22
smford22 / httpd.conf
Last active April 25, 2017 19:23
httpd.conf for training
# THIS FILE IS MAINTAINED BY CHEF. ALL MANUAL EDITS WILL BE OVERWRITTEN
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
@smford22
smford22 / base_linux.rb
Last active September 27, 2017 17:15
Base Linux Role
name 'base_linux'
description 'A base role to be applied to all linux nodes'
run_list 'recipe[chef-client::default]','recipe[chef-client::delete_validation]','recipe[audit::default]'
default_attributes({
'audit' => {
'reporter' => 'chef-server-automate',
'fetcher' => 'chef-server',
'profiles' => [
{
'name' => 'linux-patch-baseline',