I hereby claim:
- I am djaboxx on github.
- I am darnoldhashic (https://keybase.io/darnoldhashic) on keybase.
- I have a public key ASCLVtNsSUk82E3wjyoBjeEE9XrMN6aYL00-Q166tqpsVwo
To claim this, I am signing this object:
def run_cmd(host, cmd, private_key=SSH_KEY, username=SSH_USER, password=None): | |
k = paramiko.RSAKey.from_private_key_file(private_key, password) | |
c = paramiko.SSHClient() | |
c.load_system_host_keys() | |
c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
c.connect(hostname=host, username=username, pkey=k) | |
stdin, stdout, stderr = c.exec_command(cmd) | |
return dict(host=host, stdout=stdout.read(), stderr=stderr.read(), exit=stdout.channel.recv_exit_status()) |
# sample plugin | |
class AppPlugin: | |
def __init__(self, *args, **kwargs): | |
''' | |
process stuff, compile self.json_body | |
''' | |
def run(): | |
return self.json_body |
#!/usr/bin/env python | |
import os | |
def sanitize_path(path): | |
path = os.path.expandvars(path) | |
path = os.path.expanduser(path) | |
path = os.path.abspath(path) | |
return path | |
def main(): |
I hereby claim:
To claim this, I am signing this object:
provider "aws" { | |
region = "us-east-1" | |
} | |
variable "instance_per_az" { | |
default = 1 | |
description = "number of instances per Availability Zone" | |
} | |
variable "max_instances" { |
function push_vault_env { | |
WS=${2} | |
tfe_org=${1} | |
source ~/.tfe/${tfe_org} | |
tfe pushvars -name ${tfe_org}/${WS} \ | |
-senv-var "VAULT_TOKEN=${VAULT_TOKEN}" \ | |
-env-var "VAULT_ADDR=${VAULT_ADDR}" | |
} |
function push_aws { | |
WS=${2} | |
tfe_org=${1} | |
source ~/.tfe/${tfe_org} | |
tfe pushvars -name ${tfe_org}/${WS} \ | |
-senv-var "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" \ | |
-senv-var "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" \ | |
-env-var AWS_DEFAULT_REGION=us-east-1 | |
} |
function app_role { | |
role=${1} | |
policy=${2} | |
vault write auth/approle/role/${role} \ | |
secret_id_ttl=10m \ | |
token_num_uses=10 \ | |
token_ttl=20m \ | |
token_max_ttl=30m \ | |
secret_id_num_uses=40 \ | |
policies=${policy} |
#!/usr/local/bin/python | |
import requests | |
import os | |
import json | |
import sys | |
import hcl | |
def hcl_config(api, config): | |
with open(os.path.abspath(config), 'r') as fp: | |
obj = hcl.load(fp) |
#!/usr/bin/env python | |
import json | |
import subprocess, shlex | |
import os | |
from tempfile import NamedTemporaryFile as ntf | |
from collections import defaultdict | |
def read_all_with_name(path): | |
d = list_path(path) | |
_data = defaultdict(list) |