Skip to content

Instantly share code, notes, and snippets.

View double-z's full-sized avatar

Zack Zondlo double-z

View GitHub Profile
@double-z
double-z / rm_node.rb
Created February 11, 2015 19:32
delete all
#!/usr/bin/env ruby
# -*- mode: ruby -*-
require 'rubygems'
require 'chef'
require 'chef/config'
require 'chef/knife'
require 'timeout'
#chef_client_delete(ARGV[0])
@double-z
double-z / shellwords_escape.rb
Created January 29, 2015 19:19
shellwords escape
# Set SST Passwd
reset_command = 'GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO '
reset_command << "'sstuser'@'localhost'"
reset_command << " IDENTIFIED BY '"
reset_command << "#{node.run_state['db_maint_password']}"
reset_command << "';"
require 'shellwords'
cmd_sst = Shellwords.escape(reset_command)
@double-z
double-z / gist:abd332ff61875e1cbeff
Last active August 29, 2015 14:10
api-registration
Puma 1.6.3 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:4567
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Puma
create new file /home/zz/code/chef/provisioning/chef-provisioning-registry/docs/examples/.chef/provisioning/registry/192-168-33-23.json
update content in file /home/zz/code/chef/provisioning/chef-provisioning-registry/docs/examples/.chef/provisioning/registry/192-168-33-23.json from none to 7d9b0b
--- /home/zz/code/chef/provisioning/chef-provisioning-registry/docs/examples/.chef/provisioning/registry/192-168-33-23.json 2014-11-24 12:53:20.372263725 -0500
@double-z
double-z / gist:e65efcfe9a03340a1e82
Created November 21, 2014 05:20
registry-entry-via-register-machine-resource-with-retrieve-specs-options.json
cat registry/192-168-33-23.json
{
"id": "192-168-33-23",
"status": "available",
"registry_options": {
"ip_address": "192.168.33.23",
"machine_types": [
"rails_server"
],
"mac_address": "08:00:27:fb:6a:18",
@double-z
double-z / gist:26f5e73c88c052c11a34
Created November 21, 2014 04:19
registered-machine-entry.json
$ knife data bag show registry one -Fj
{
"id": "one",
"machine_options": {
"transport_options": {
"host": "192.168.33.22",
"username": "provisioner",
"ssh_options": {
"user": "provisioner",
"keys": [
@double-z
double-z / gist:35012aab6b1d44273e7f
Created November 21, 2014 04:17
registry-entry-via-api.json
$ ls -1 registry/
192-168-33-22.json
192-168-33-22.pem
$ cat registry/192-168-33-22.json
{
"id": "192-168-33-22",
"status": "available",
"location": {
"registry_machine_path": "/home/zz/metal/chef-metal/docs/examples/registry/192-168-33-22.json"
},
# #!/bin/bash
#
# Add this script to /etc/rc.local i.e:
# /bin/bash /usr/local/bin/chef_provisioning_auto_register
#
API_URL='http://registry-api:4567/v1/registry'
TMP_FILE='/tmp/out.txt'
MACHINE_TYPE='rails_server'
USER_NAME='provisioner'
#!/bin/bash
VAGRANT_DIR="/home/vagrant/"
if [ -d $VAGRANT_DIR ]
then
DEFAULT_GW_IFACE='eth1'
else
DEFAULT_GW_IFACE=`route -n | grep UG | awk '{print $8}'`
fi
DEFAULT_IFACE_IP=`ifconfig | grep -A 1 ^$DEFAULT_GW_IFACE | grep addr | awk -Faddr: '{print $2}' | awk '{print $1}' | grep -v '^$'`
knife ssh 'name:*' 'uptime' -G [email protected] -a private_ipaddress -x user
# to run chef-client on all servers:
knife ssh 'name:*' 'sudo chef-client' -G [email protected] -a private_ipaddress -x user

getchef4-test1

[gfm] Introducing Chef Metal 0.2! Chef Metal is a framework that lets you manage your *clusters* with Chef the same way you manage machines: with recipes. Combined with the power of Chef, Metal's `machine` resource helps you to describe, version, deploy and manage everything from simple to complex clusters with a common set of tools.

To get it, gem install chef-metal. To hack, go to https://github.com/opscode/chef-metal. Currently supported provisioners include LXC containers, EC2, DigitalOcean, and Vagrant. If you just want to skip all that, follow the quick start in the README.

The current release is an alpha. You can see a lot of our plans, and some concrete examples, in the [requirements doc](https://github.com/opscode/chef-metal/blob/master/docs/r