Skip to content

Instantly share code, notes, and snippets.

Avatar

Phil Porada pporada-gl

View GitHub Profile
View gist:b88253a4f4356475f78524f2190ac0d8
{
"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`}}",
View uchiwa bats tests
#!/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 ]
View gist:f6500d9ebc436df9c8bd955753cfc2e2
mkdir ~/gocode
cat << "EOL" >> ~/.bashrc
export GOPATH="$HOME/gocode"
export PATH=$GOPATH/bin:"${PATH}"
EOL
source ~/.bashrc
go get github.com/tools/godep
View indirect expansion
ENVIRONMENT="$1"
test_CNT="thing1 thing2 thing3"
beta_CNT="thing4 thing5 thing6"
for i in ${${ENVIRONMENT}_CNT}; do
echo $i
done
####
View gist:f2f6af93b148a693fc6409bfcb7100d5
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}"
View gist:9b2ec26c8d6c1f94c6faea27baee5fb3
### 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
View gist:7d27727dc80173d0f3d594321c3f4aac
$ cat Jenkinsfile
#!/usr/bin/env groovy
node {
git credentialsId: '4sdjfsdkjbfgksjdbfksjdbfkjsdbfkjsdbfjkbsdfb', url: 'git@bitbucket.org:/terraform-autobot.git'
withEnv(["SOURCE_BUILD_NUMBER=${env.BUILD_NUMBER}"]) {
sh '''#!/bin/bash
echo $SOURCE_BUILD_NUMBER
echo "======="
View My TF Remote State
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"
View example remote state
68 "resources": {
69 "data.terraform_remote_state.build-vpc": {
70 "type": "terraform_remote_state",
71 "depends_on": [],
72 "primary": {