Skip to content

Instantly share code, notes, and snippets.

Mr. Pacman vinyar

Block or report user

Report or block vinyar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vinyar
vinyar / secret.rb
Last active Jun 8, 2017 — forked from sethvargo/secret.rb
updated_by_last_action example - Chef extension to extract secrets from HashiCorp's Vault
View secret.rb
# Please see the following blog post for more information:
#
# https://www.hashicorp.com/blog/using-hashicorp-vault-with-chef.html
#
resource_name :vault_secret
property :path, String, name_property: true
property :destination, String
@vinyar
vinyar / powershell.ps1
Created Jun 7, 2017
echoing out pem to remote windows workstation
View powershell.ps1
-join $(openssl rand -base64 512) > secret_key
cat secret_key
knife winrm -m <IP> -x <USER> -P <PASS> "echo $(gc .\secret_key)>c:\chef\secret_key"
@vinyar
vinyar / Chef-Shell.rb
Last active May 5, 2017
How to find out where Chef constructs are coming from via Chef-Shell and Test Kitchen through Pry
View Chef-Shell.rb
$ chef-shell [ruby-2.0.0p648]
loading configuration: none (standalone session)
Session type: standalone
Loading...........done.
...
chef (12.19.36)> require 'pry'
=> true
chef (12.19.36)> node
@vinyar
vinyar / example
Last active Apr 30, 2017
example
View example
app_cookbook
attribute file
--> default['ms_dsc']['supported_modules'] = %w(mod1 mod5 mod19)
recipe
include_recipe 'ms_dsc'
@vinyar
vinyar / gist:d214d8300318f582a371d423bc1b8cd4
Created Apr 25, 2017 — forked from btsai/gist:f0a462ceec17126a5beda5705d323057
Ruby script to parse for large files in git repo
View gist:d214d8300318f582a371d423bc1b8cd4
# gist to create file size list:
# run this in irb in your git folder.
# will output a text file to the parent folder with a listing of each filepath and file size.
# NOTE: nil is added to the end of each line to prevent outputting the result of the iterator blocks.
lines = `git gc && git verify-pack -v .git/objects/pack/pack-*.idx`.split("\n"); nil
objects = lines.find_all{ |line| line.match(/^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$/) }; nil
shas = `git rev-list --objects --all | sort -k 2`.chomp.split("\n"); nil
map = shas.inject({}){ |hash, line| sha, file = line.split(' '); hash[sha] = file unless file.nil?; hash }; nil
sizes = objects.map{ |line| sha, type, size = line.gsub(/\s+/, ' ').split(' '); file = map[sha]; [size.to_i, file] if file }; nil
View output
Note that IP address 2.2.2.2 is added as it should, but then hostname resource removes it.
Recipe: lk_base::via_hostfile
* hostsfile_entry[127.0.1.1] action create
Recipe: <Dynamically Defined Resource>
* file[/etc/hosts] action create
- update content in file /etc/hosts from 7e4391 to 6994f8
--- /etc/hosts 2017-04-13 00:12:00.526652000 +0000
+++ /etc/.chef-hosts20170413-20240-1njwh1c 2017-04-13 00:17:10.693658000 +0000
@@ -9,9 +9,9 @@
@vinyar
vinyar / Process improvement notes.yml
Created Jan 31, 2017
Process improvement notes.yml
View Process improvement notes.yml
Personell Checklist:
Any scheduled PTO?
Any on-call rotations
Any mandatory meetings they have to attend.
Is there a deisgnated person to assist with fires?
- can they give someone half time to be in a room, but not on project
- can get creative here, but end result is you need undivided attention
Can we turn off their Mail
Can we turn off their slack/communicator/lync/etc..
Realistically, how long can staff be away from their primary job
@vinyar
vinyar / README.md
Created Dec 13, 2016 — forked from afiune/README.md
Automate LDAP Bulking User Creation
View README.md

LDAP Bulking User Creation Process

This is temporal automation to create multiple LDAP users in Chef Automate.

Prerequisites

The minimum prerequisites to be able to use this automation are:

@vinyar
vinyar / unencrypted portion if needed.json
Last active Nov 18, 2016
rewrite of the users cookbook
View unencrypted portion if needed.json
{
"id": "212477770",
"comment": "212477770",
"home": "/home/212477770",
"action": "remove",
"shell": "/bin/bash",
"ssh_keys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHn3gAaYLt23e8mZcb2XZ3rXSxqD+1w+44lAM+hpZV7T34CFz7EhPNlno+QLFHk8CE5pTPzYNQmfjxkCSe3D93tIEV2XkOV/sCdT/XuCZa0tZf4k1JKcky+Z/fsTJp7ML+BjvPpFj00ZccRAUX9OWuXP02dl3K6bTgstWJKys6El05PuwJZQk14XkJ9TWUnFwdFar4yfapa4xcMmF0XDqs8SYmxHedvxl1+hCV1PCcJ1c9RxX9Qfomwyx2QTlbirEyw9FzE/rMRujj3dEZS+ExHY0Gy4yAjM8N3tq6gqoYe5jWQUekbujuu+txUKQcUmnB55x5NZHgqEG6S+p30QVhFri8Vgh+Gc4J0CZc3Wl1qe+eyAtB3X+wdFDuEIamsZfEAXmgxAecEMmbqw4unk4sDcjeiQ7cveghGEBkXk09vbRigyhLqNsfUSm6KYm0KkolQHmLAqH2SZ5oETKsXv9wi8Gt0RjrVWD9XHZ8E4QFKTYHrXMuEeK3HEbw2BC3AiagcfHggxIZ3ScHVDVgB/LqW2G+/BYy3mEt3EBrUz/OozuU2tmE/Oug6XkxadwQj8aIjURVGIw+aOoH1XFmAJxfzJMh+Iv94rmy2z3v/RxVan8WDI8dFbEiidI6oyQ4hB9MA57t7zDWMlGkSvxhlRNtyaKYyPyU1Qki+8YVDqEipw== 212477770@SFO1212477770M"
],
"groups": [
@vinyar
vinyar / Chef-metadata-environment-pattern.rb
Created Nov 17, 2016 — forked from zuazo/Chef-metadata-environment-pattern.rb
This Chef Cookbook metadata.rb example reads the dependencies from Berksfile.lock. (Experimental)
View Chef-metadata-environment-pattern.rb
# metadata.rb
# This metadata.rb example reads the dependencies from Berksfile.lock. This can
# be used to implement the Environment Pattern with Chef Server.
#
# The Environment Cookbook:
# http://blog.vialstudios.com/the-environment-cookbook-pattern/
name 'my_face'
# [...]
You can’t perform that action at this time.