Skip to content

Instantly share code, notes, and snippets.

View pporada-gl's full-sized avatar

Phil Porada pporada-gl

View GitHub Profile
{
"builders": [
{
"access_key": "{{user `var_aws_access_key`}}",
"ami_description": "Built from the GL cut CentOS7. This is a fairly standard CentOS7 image.",
"ami_name": "CentOS 7 x86_64 Base {{timestamp}}",
"associate_public_ip_address": true,
"enhanced_networking": true,
"instance_type": "{{user `var_aws_instance_type`}}",
"region": "{{user `var_aws_region`}}",
#!/usr/bin/env bats
@test "Ensure uchiwa is running" {
run systemctl is-active uchiwa
[ "$status" -eq 0 ]
}
@test "Ensure uchiwa is enabled" {
run systemctl is-enabled uchiwa
[ "$status" -eq 0 ]
mkdir ~/gocode
cat << "EOL" >> ~/.bashrc
export GOPATH="$HOME/gocode"
export PATH=$GOPATH/bin:"${PATH}"
EOL
source ~/.bashrc
go get github.com/tools/godep
ENVIRONMENT="$1"
test_CNT="thing1 thing2 thing3"
beta_CNT="thing4 thing5 thing6"
for i in ${${ENVIRONMENT}_CNT}; do
echo $i
done
####
@pporada-gl
pporada-gl / gist:f2f6af93b148a693fc6409bfcb7100d5
Created January 3, 2017 19:22
Terraform security group example
resource "aws_security_group" "jenkins" {
name = "${var.env}_${var.tier}_jenkins_secgroup"
vpc_id = "${var.vpc_id}"
description = "jenkins security group"
tags {
Name = "${var.env}_${var.tier}_jenkins_secgroup"
TERRAFORM = "true"
ENV = "${var.env}"
TIER = "${var.tier}"
### Assume this list of ips
192.168.33.10,192.168.33.11,192.168.33.12
"retry_join": [{% for h in groups['consul_servers'] %}"{{ hostvars[h].ansible_eth1.ipv4.address|difference(ansible_all_ipv4_addresses)|list }}"{% if not loop.last %},{% endif %}{% endfor ,
### This will output
"retry_join": ["[u'1', u'9', u'2', u'.', u'6', u'8', u'3', u'0']"],
### I am looking for the following instead of ^
#### Assuming I am on box 192.168.33.12
$ cat Jenkinsfile
#!/usr/bin/env groovy
node {
git credentialsId: '4sdjfsdkjbfgksjdbfksjdbfkjsdbfkjsdbfjkbsdfb', url: '[email protected]:/terraform-autobot.git'
withEnv(["SOURCE_BUILD_NUMBER=${env.BUILD_NUMBER}"]) {
sh '''#!/bin/bash
echo $SOURCE_BUILD_NUMBER
echo "======="
variable "region" {}
variable "aws_access_key" {}
variable "aws_secret_key" {}
variable "env" {}
variable "company" {}
data "terraform_remote_state" "build-vpc" {
backend = "s3"
config {
region = "us-east-1"
68 "resources": {
69 "data.terraform_remote_state.build-vpc": {
70 "type": "terraform_remote_state",
71 "depends_on": [],
72 "primary": {