Skip to content

Instantly share code, notes, and snippets.

View scarolan's full-sized avatar
🤸‍♂️
In whatever position one is in...one must find balance. -BKS Iyengar

Sean Carolan scarolan

🤸‍♂️
In whatever position one is in...one must find balance. -BKS Iyengar
View GitHub Profile
@scarolan
scarolan / gist:f93a8f9b362c4d3a4436
Last active November 20, 2015 19:27
Set the tab name in iTerm to contain the current directory and git branch
function set_iterm_title {
echo -ne "\e]1;$1\a"
}
function git_branch {
BRANCH_REFS=$(git symbolic-ref HEAD 2>/dev/null) || return
GIT_BRANCH="${BRANCH_REFS#refs/heads/}"
[ -n "$GIT_BRANCH" ] && echo "$GIT_BRANCH "
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1431095274000",
"Effect": "Allow",
"Action": [
"ec2:AllocateAddress",
"ec2:AssignPrivateIpAddresses",
"ec2:AssociateAddress",
##########################
chef-sa-group AWS EC2 Instance Report
##########################
If you have instances listed below and would like to remove them from this
report, add an AWS tag named Persist to your instances and set it to true.
Any instances flagged with Persist=true tags will be ignored by this report.
cdsge-provisioner|i-0054ffc4|us-west-2a|infra-node-praesidio-httpdbaas-acceptance-1|4 days 2 hours 48 minutes and 55 seconds
cdsge-provisioner|i-092ff6cd|us-west-2a|infra-node-ae-sge-sitedbaas-rehearsal-1|10 days 5 hours 58 minutes and 41 seconds
use_inline_resources
action :create do
# Set the document root
document_root = "/srv/apache/#{new_resource.site_name}"
# Add a template for Apache virtual host configuration
template "/etc/httpd/conf.d/#{new_resource.site_name}.conf" do
source "custom.erb"
mode "0644"
@scarolan
scarolan / gist:794132f8a5befe227b49
Created October 6, 2015 03:03 — forked from jimcroft/gist:3878113
Enable WinRM for Chef bootstrapping via EC2 user data
<powershell>
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow
@scarolan
scarolan / default.rb
Created October 5, 2015 20:58
default.rb
powershell_script "Install IIS" do
action :run
code "add-windowsfeature Web-Server"
end
service "w3svc" do
action [ :enable, :start ]
end
template 'c:\inetpub\wwwroot\Default.htm' do
control_group 'SSH Security' do
control 'SSH' do
it 'should be listening on port 22' do
expect(port(22)).to be_listening
end
it 'disables root logins over ssh' do
expect(file('/etc/ssh/sshd_config')).to contain('PermitRootLogin no')
end
LineLength:
Enabled: false
StringLiterals:
Enabled: false
HashSyntax:
Enabled: false
SpaceInsideParens:
Enabled: false
SpaceInsideBrackets:
Enabled: false
require 'spec_helper'
describe 'motd::default' do
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
it 'creates an motd correctly' do
expect(chef_run).to create_template('/etc/motd').with(
:user => 'root',
:group => 'root',
:mode => '0644'
)
( •_•)
( •_•)>⌐■-■
(⌐■_■)