Skip to content

Instantly share code, notes, and snippets.

View daxroc's full-sized avatar

Damien Roche daxroc

  • Wexford, Ireland
View GitHub Profile
@daxroc
daxroc / IAM Policy
Last active June 2, 2017 15:44
AWS Federated S3 Read Only Bucket and IAM policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadOnlySharedBucket",
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*"
],
@daxroc
daxroc / awsenv.py
Created June 1, 2017 08:56
AWS ECS python script to export container IAM credentials for use with various tools
#!/usr/bin/env python
import os, urllib, json
uri = os.environ['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
url = "http://169.254.170.2{}".format(uri)
data = json.loads(urllib.urlopen(url).read())
print """export AWS_ACCESS_KEY_ID={AccessKeyId}
export AWS_SECRET_ACCESS_KEY={SecretAccessKey}
export AWS_SESSION_TOKEN={Token}
@daxroc
daxroc / gist:0ddb4b8fb00572eb3711554a0b787e58
Created May 1, 2017 16:18
Saltstack - Jinja Mine.get
{%- set nodes = salt['saltutil.runner']('mine.get',
tgt='G@ec2_tags:Environment:Ether',
fun='agent_uuid',
tgt_type='compound').values()|map(attribute='myapp:agent:uuid')|list %}
- url: /api/v1/user
script: user
# Requires login + admin
login: admin
auth_fail_action: unauthorized
- url: /api/v1/user/view
script: user.view
# Requires login but not admin
login: required
require 'chef/provisioning'
machine 'mario' do
tag 'itsa_me'
end
chef-client -z provision.rb
DL is deprecated, please use Fiddle
================================================================================
Recipe Compile Error in /tmp/kitchen/cookbooks/iii/recipes/default.rb
================================================================================
NoMethodError
-------------
Undefined method or attribute `action' on `node'
remote_file "/tmp/myfile.tmp" do
source "http://example.com/test.tmp"
checksum "incorrect_should_cause_redownload"
retries 3
retry_delay 20
end
last_checksum = File.open(last_file) do | f |
md5 = Digest::MD5.new
buffer = ""
md5.update(buffer) while f.read(4096, buffer)
md5
end
---
driver:
name: vagrant
provisioner:
name: chef_solo
roles_path: "../../roles"
environments_path: "../../environments"
platforms: