Skip to content

Instantly share code, notes, and snippets.

View irvingpop's full-sized avatar

Irving Popovetsky irvingpop

View GitHub Profile
@irvingpop
irvingpop / knife-opc_usage_notes.txt
Created March 6, 2014 17:40
knife-opc usage notes
[root@private-chef ~]# gem install knife-opc
Fetching: knife-opc-0.0.1.gem (100%)
Successfully installed knife-opc-0.0.1
1 gem installed
Installing ri documentation for knife-opc-0.0.1...
Installing RDoc documentation for knife-opc-0.0.1...
[root@private-chef ~]# cat .chef/knife.rb
log_level :info
log_location STDOUT
@irvingpop
irvingpop / knife-ec-backup_usage_notes.md
Last active August 29, 2015 13:57
knife-ec-backup usage notes

Running as root on CentOS 6

[root@private-chef ~]# cat .chef/knife.rb 
log_level :info
log_location STDOUT

# Run as pivotal user
node_name 'pivotal'
client_key '/etc/opscode/pivotal.pem'
@irvingpop
irvingpop / ec11.1-ldap-bug.txt
Last active August 29, 2015 13:57
Patching the EC11.1 LDAP user creation bug
EC 11.1.x has a bug [OC-11384] when an LDAP user attempts to create a new account
that has never existed in the Enterprise Chef database before, rather than linking
with an existing internal user.
Please apply the attached patch to your EC 11.1.x release:
$ cd /opt/opscode/embedded/service/gem/ruby/1.9.1/bundler/gems/mixlib-authorization-c03f584a371b
$ patch -p1 < /tmp/cache/ec11.1-ldap500error.patch
patching file lib/opscode/models/user.rb
$ private-chef-ctl restart opscode-account
@irvingpop
irvingpop / gist:9636290
Created March 19, 2014 06:05
RHEL6.5 LVM thin volumes and snapshots
[root@backend1 ~]# vgcreate opscode /dev/sdb
Volume group "opscode" successfully created
[root@backend1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 2 0 wz--n- 39.51g 0
opscode 1 0 0 wz--n- 2.00g 2.00g
[root@backend1 ~]# lvcreate -L 2G -T opscode/thinpool
Logical volume "lvol0" created
Volume group "opscode" has insufficient free space (510 extents): 512 required.
[root@backend1 ~]# lvcreate -L 2000M -T opscode/thinpool
@irvingpop
irvingpop / upgrade.md
Last active August 29, 2015 13:57 — forked from jeremiahsnapp/upgrade.md
Enterprise Chef 11 upgrade procedure
@irvingpop
irvingpop / orgmapper_all_client_versions.rb
Last active August 29, 2015 14:00
Orgmapper snippet to output all nodes with client versions in all organizations to a JSON file
# Orgmapper snippet to output all nodes with client versions in all organizations to a JSON file
# To Use:
# 1) Start orgmapper
# 2) Load the script
# eval(::File.read("/path/to/orgmapper_all_client_versions.rb"))
# 3) output will be printed to the screen and also written to JSON_OUTPUT_FILE
JSON_OUTPUT_FILE = 'chef_versions.json'
@irvingpop
irvingpop / check-data.rb
Last active August 29, 2015 14:01
knife-ec-backup data validation
#!/opt/chef/embedded/bin/ruby
require 'json'
class Checker
def check
check_cookbook_metadata
check_node_sizes
check_bad_platform_metadata
check_bad_invitations
check_duplicates_in_groups
@irvingpop
irvingpop / EC-rsync-upgrade-process.md
Last active August 29, 2015 14:01
Enterprise Chef rsync migration+upgrade procedure

Customer Scenario

A customer has an OPC 1.4.x HA installation in Production. They want to test an in-place upgrade from OPC 1.4.x all the way through to EC11.1.6 using their current OPC Production data and config. This gives us a good chance to make corrections if we find that their data is too broken for the migrations to handle, and gives the customer experience in managing the upgrade in Production.

The sequence of events will broadly be these:

  • Install OPC 1.4.11 on target HA Test cluster
  • Restore data from Production OPC 1.4.11 instance LVM snapshot backup produced by our drbd-backups script
  • Test
@irvingpop
irvingpop / drbd-lv-shrink.md
Last active November 24, 2022 06:44
EC11 Shrink the DRBD LV to make room for snapshots
@irvingpop
irvingpop / orgmapper-find-oprhaned-objects.rb
Last active August 29, 2015 14:01
Stupid Orgmapper Tricks
org_guids = ORGS.all.map {|o| o.guid}
sql.select(:checksum, :org_id).from(:nodes).exclude(:org_id => org_guids)
# sql.select(:checksum, :org_id).from(:nodes).exclude(:org_id => org_guids).delete
sql.select(:checksum, :org_id).from(:cookbook_version_checksums).exclude(:org_id => org_guids)
# sql.select(:checksum, :org_id).from(:cookbook_version_checksums).exclude(:org_id => org_guids).delete