Skip to content

Instantly share code, notes, and snippets.

@stark525
stark525 / install-and-keys
Last active August 29, 2015 14:10
Install hiera-eyaml
gem install hiera-eyaml
eyaml createkeys
@stark525
stark525 / key-perms
Created December 3, 2014 02:21
Create puppet directory for your keys and set permissions
chown -R puppet:puppet /var/lib/puppet/keys
chmod -R 0500 /var/lib/puppet/keys
chmod 0400 /var/lib/puppet/keys/*.pem
@stark525
stark525 / hiera.yaml
Created December 3, 2014 02:26
/etc/hiera.yaml
:backends:
- eyaml
- yaml
:yaml:
:datadir: '/etc/puppet/hieradata'
:eyaml:
:datadir: '/etc/puppet/hieradata'
# If using the pkcs7 encryptor (default)
@stark525
stark525 / link-hiera.yaml
Created December 3, 2014 02:31
Link /etc/hiera.yaml to /etc/puppet/hiera.yaml
@stark525
stark525 / config.yaml
Created December 3, 2014 02:36
eyaml config file for ~/.eyaml/config.yaml
---
pkcs7_private_key: '/var/lib/puppet/keys/private_key.pkcs7.pem'
pkcs7_public_key: '/var/lib/puppet/keys/public_key.pkcs7.pem'
@stark525
stark525 / eyaml-encrypt
Created December 3, 2014 02:40
Dump the output of this into your app.eyaml file
eyaml encrypt -s 'secretpassword' -l 'parameter-lookup'
@stark525
stark525 / puppet.conf
Created December 3, 2014 02:45
If you want to link hiera.yaml to some other path, add this to your puppet.conf
hiera_config=/some/other/path/hiera.yaml
git clone https://<private-git>/codebattles
git checkout -b dstark
#!/usr/bin/env python
import boto3
import json
import base64
def headers_to_go_style(headers):
retval = {}
for k, v in headers.items():
retval[k] = [v]
def get_ip_of_peer_instances_and_write_to_settings_file(self):
'''
This is run on the source EC2 instance as part of UserData bootstrapping
1) Look at the peer(s)' VPC CloudFormation Stack's Outputs for a list of subnets, public or private as defined
in the constructor.
2) Find instances in those subnets created by this library
3) Get the Private IP address of target instances and write it to a local configuration file
'''
# Query for peer CloudFormation, get instances