Skip to content

Instantly share code, notes, and snippets.

View skylerto's full-sized avatar

Skyler Layne skylerto

View GitHub Profile
default['waiver_file_name'] = node['ec2'] ? 'aws.yml' : 'on-prem.yml'
default['audit']['waiver_file'] = "#{Chef::Config[:file_cache_path]}/#{node['waiver_file_name']}"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "bento/centos-7.4"
config.vm.network "private_network", ip: "192.168.33.10"
@skylerto
skylerto / config.rb
Created March 24, 2018 16:14
Example config.rb for chef
# => .chef/config.rb
# see https://docs.chef.io/config_rb.html
# Chef commands interaction
cookbook_path ['path_to_cookbooks']
# Knife commands will run against local as opposed to a chef server,
# files created on the local as opposed to temp files then upload to chef
# server.
#!/bin/bash
SSL_PORT=8443
CHEF_DIR=$(pwd)/.chef
# docker run --privileged -t --name localhost -d -p $SSL_PORT:443 -e CONTAINER_NAME=localhost cbuisson/chef-server
if [ -d "$CHEF_DIR" ]; then
rm -rf $CHEF_DIR
fi
@skylerto
skylerto / clean_docker_nexus.sh
Created January 12, 2018 20:23 — forked from matzegebbe/clean_docker_nexus.sh
Nexus Repository Manager keep the last X docker images delete all other
#!/bin/bash
REPO_URL="https://repository.xxx.net/repository/"
USER="admin"
PASSWORD="datpassword"
BUCKET="portal-docker"
KEEP_IMAGES=10
IMAGES=$(curl --silent -X GET -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -u ${USER}:${PASSWORD} "${REPO_URL}${BUCKET}/v2/_catalog" | jq .repositories | jq -r '.[]' )
@skylerto
skylerto / change.rb
Created December 19, 2017 13:42
Structs and attributes: wrapping a Struct in a class
require 'ostruct'
module AutomateSoup
##
# Class to represent operations on a change.
#
class Change
def initialize(hash)
@source = OpenStruct.new hash
end
@skylerto
skylerto / gist:9277afb86fa1bcf078dd0535888e8dc6
Created December 11, 2017 18:08 — forked from amokan/gist:3881064
jenkins-cli commands (v1.485)
build
Builds a job, and optionally waits until its completion.
cancel-quiet-down
Cancel the effect of the "quiet-down" command.
clear-queue
Clears the build queue
connect-node
Reconnect to a node
copy-job
Copies a job.
extern crate serde_json;
extern crate handlebars;
#[macro_use]
extern crate maplit;
use std::path::Path;
use handlebars::Handlebars;
use serde_json::Value;
$LOAD_PATH.unshift(*Dir[File.expand_path('../vendor/gems/**/lib', __FILE__)])
require 'ruby_expect'
# Custom resource based on the InSpec resource DSL
class PerlModules < Inspec.resource(1)
name 'perl_modules'
desc "
Perl Modules resource for extracting the perl modules via instmodsh.
require 'mail'
args = ARGV
user = args[0]
pass = args[1]
options = { :address => "smtp.gmail.com",
:port => 587,
:user_name => user,
:password => pass,