Skip to content

Instantly share code, notes, and snippets.

View mechastorm's full-sized avatar

Shih Oon Liong mechastorm

View GitHub Profile
https://github.com/ansible/ansible/releases.atom
https://github.com/ansible/molecule/releases.atom
https://github.com/ansible/ansible-lint/releases.atom
https://github.com/inspec/inspec/releases.atom
https://github.com/gravitational/teleport/releases.atom
https://github.com/hashicorp/consul/releases.atom
https://github.com/hashicorp/terraform/releases.atom
https://github.com/hashicorp/vault/releases.atom
https://github.com/runatlantis/atlantis/releases.atom
https://github.com/terraform-providers/terraform-provider-github/releases.atom

Keybase proof

I hereby claim:

  • I am mechastorm on github.
  • I am mechastorm (https://keybase.io/mechastorm) on keybase.
  • I have a public key ASDBNG2rttEyCfqCP9WJ8RhiJVL30cnynTncx_zuI5tkCAo

To claim this, I am signing this object:

@mechastorm
mechastorm / _service.md
Created January 31, 2018 21:37 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@mechastorm
mechastorm / teleport.sh
Last active August 2, 2017 19:59
Teleport Upstart Script
#!/bin/bash
#
# /etc/rc.d/init.d/teleport
#
# Daemonize the teleport agent.
#
# chkconfig: 2345 95 20
# description: SSH Infrastructure for clusters and teams # processname: teleport
# pidfile: /var/run/teleport/pidfile
2017/06/08 18:02:44 [INFO] Terraform version: 0.9.8
2017/06/08 18:02:44 [INFO] Go runtime version: go1.8.3
2017/06/08 18:02:44 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.9.8/bin/terraform", "apply"}
2017/06/08 18:02:44 [DEBUG] Detected home directory from env var: /myfolder
2017/06/08 18:02:44 [DEBUG] Detected home directory from env var: /myfolder
2017/06/08 18:02:44 [DEBUG] Attempting to open CLI config file: /myfolder/.terraformrc
2017/06/08 18:02:44 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/06/08 18:02:44 [INFO] CLI command args: []string{"apply"}
2017/06/08 18:02:44 [DEBUG] Detected home directory from env var: /myfolder
2017/06/08 18:02:44 [DEBUG] command: loading backend config file: /myfolder/ops/workspace/folder
@mechastorm
mechastorm / gist:78c131ce672e5ffa6fd8ac12c872caed
Last active October 23, 2017 22:32
Installing Cloud Custodian Mailer
# Source from https://github.com/capitalone/cloud-custodian/tree/master/tools/c7n_mailer
git clone https://github.com/capitalone/cloud-custodian
# Not mentioned in docs, you should run from the root of the repo
cd cloud-custodian
virtualenv c7n_mailer
source c7n_mailer/bin/activate
# In the README, it mentions to instead `cd c7n_mailer` but that goes to the virualenv environment, that has no requirements.txt
@mechastorm
mechastorm / gist:2e379788e5f56239d5f32d9cb98c420a
Created May 5, 2017 21:39
Correct Custodian Policy that validates correctly
policies:
- name: ec2-auto-tag-owner
resource: ec2
mode:
type: cloudtrail
events:
- RunInstances
filters:
- "tag:Owner": absent
actions:
(custodian) vagrant@sliong:/workspace/custodian$ custodian validate test.yml
2017-05-05 21:32:41,128: custodian.commands:ERROR Configuration invalid: test.yml
2017-05-05 21:32:41,136: custodian.commands:ERROR {'filters': [{'tag:Owner': 'absent'}], 'name': 'ec2-auto-tag-owner', 'actions': [{'tag': 'OwnerContact', 'type': 'auto-tag-user'}], 'mode': {'type': 'cloud-trail', 'events': ['CreateInstance']}} is not valid under any of the given schemas
Failed validating 'anyOf' in schema['properties']['policies']['items']:
{'anyOf': [{'$ref': '#/definitions/resources/firehose/policy'},
{'$ref': '#/definitions/resources/rds-cluster-snapshot/policy'},
{'$ref': '#/definitions/resources/event-rule/policy'},
{'$ref': '#/definitions/resources/elb/policy'},
{'$ref': '#/definitions/resources/redshift-snapshot/policy'},
@mechastorm
mechastorm / gist:a9547d808c3ca5962bebc7b73f421797
Created May 5, 2017 21:28
Auto tag Owner if tag does not exist
policies:
- name: ec2-auto-tag-owner
mode:
type: cloud-trail
events:
- CreateInstance
filters:
- tag:Owner: absent
actions:
- type: auto-tag-user
@mechastorm
mechastorm / nginx_view_stage.conf
Created April 25, 2015 02:26
nginx_view_stage
server {
set $rootPath /var/www/vhosts/mysite/public;
listen 80;
server_name assets.mydomain.com;
root $rootPath;
access_log /var/log/nginx/access_assets.log;