Skip to content

Instantly share code, notes, and snippets.

View Maniacal's full-sized avatar

Michael Glenney Maniacal

  • New Context
  • Phoenix, Arizona, US
View GitHub Profile
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.7
- RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-linux]
- INSTALLATION DIRECTORY: /opt/ruby/1.9.3-p448/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /opt/ruby/1.9.3-p448/bin/ruby
- EXECUTABLE DIRECTORY: /opt/ruby/1.9.3-p448/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
@Maniacal
Maniacal / gist:7016848
Created October 16, 2013 23:35
chef attributes weirdness
Here's some test stuff I've setup to figure this out:
access_control provider:
action :add do
if new_resource.environments.include?(node.chef_environment)
case new_resource.type
when "user"
puts ""
puts "Default before add: #{node.default.authorization.access.users}"
var1 = node['domain_home'] + "/" + node['domain_name'] + "/var1"
var2 = node['domain_home'] + "/somepath/var2"
%w{var1 var2} each do |domain_directory|
directory domain_directory do
mode 0775
owner 'weblogic'
group 'weblogic'
action :create
recursive true
cat > /etc/chef/client.rb <<'EOP'
log_level :auto
log_location "/var/log/chef/client.log"
chef_server_url "<%= @chef_config[:chef_server_url] %>"
validation_client_name "<%= @chef_config[:validation_client_name] %>"
node_name "<%= @config[:chef_node_name] %>"
environment "<%= @chef_config[:environment] %>"
http_proxy "<%= knife_config[:bootstrap_proxy] %>"
https_proxy "<%= knife_config[:bootstrap_proxy] %>"
...
@Maniacal
Maniacal / gist:f5599468faacba88e249
Last active August 29, 2015 14:05
iops parameter issue
Here are the params being passed:
{ "ParameterKey": "MysqlDBAllocatedStorage", "ParameterValue" : "250" },
{ "ParameterKey": "MysqlDBIOPS", "ParameterValue" : 2000 },
{ "ParameterKey": "MysqlDBInstanceClass", "ParameterValue" : "db.m3.xlarge" }
Here's the parameter declaration:
"MysqlDBIOPS" : {
"Description" : "Number of IOPS to provision; 1000 increments per 100GB allocated storage",
In the error below, ldap_servers is an array passed to the template. Array is being defined in the cookbook attributes
Chef::Mixin::Template::TemplateError (Node attributes are read-only when you do not specify which precedence level to set. To set an attribute use code like `node.default["key"] = "value"') on line #14:
12: # Multiple entries may be specified. The address that is used
13: # here should be resolvable without using LDAP (obviously).
14: uri <% nodes = @ldap_servers.collect! { |a| "ldaps://" + a } -%><%= nodes.join(" ") %>
15: base <%= @ldap_base %>
16: tls_cacertdir <%= @certdir %>
define :deploy_archive, :type => "zip" do
module_name = params[:name]
destination = params[:destination]
bundle_path = "#{Chef::Config[:file_cache_path]}/#{node['deployment']['id']}"
execute "Clean out destination" do
user 'root'
command "rm -rf #{destination}/*"
$ ls ~/.berkshelf/cookbooks/
access_control-268e48575f97f44877550166d8044bfa15c68a7c/ ll_aws_linux-8ddb9180378771b8b7186fc70aabcd2a294e180f/
apache2-ae50a8b010e8834ab0f2cf5b5a889870aee6aa43/ php-719317d45edd60b887f5f57f553304e0f4d641a5/
bashrc-3b207fddf5593e5f3abb03b233e61a5b9f023502/ tomcat-a7cbe270ccaa963bf02913dcad38ae92975b12c3/
deploy-56a5396635b41b6c78bcef43f21c68f4de3cc433/ wallet_common-4e6985b43a4c2e099b4e072767648e6ed1a7ae54/
java-c5fe6c4ba13545330501341c87ebc8d15cd256f9/
## Here's the block_mappings snippet where I'm setting that up and the part of the script where I create the build command
===========================================================================================================================
block_mappings='[{\"DeviceName\":\"/dev/xvdf\",\"Ebs\":{\"VolumeSize\":100,\"VolumeType\":\"gp2\",\"DeleteOnTermination\":false}},{\"DeviceName\":\"/dev/xvdg\",\"Ebs\":{\"VolumeSize\":1000,\"VolumeType\":\"gp2\",\"DeleteOnTermination\":false}}]'
# Create the build command
build_command="aws ec2 run-instances --image-id $image_id --key-name $key_name --security-group-ids $security_group_ids --instance-type $instance_type --subnet-id ${subnet_ids[$i]} --iam-instance-profile Name=${env_prefix}-wallet-server --user-data file://${env_prefix}_wallet.sh"
if [[ "$environment" != development ]]; then
@Maniacal
Maniacal / .kitchen.yml
Created January 27, 2015 21:47
Fail to converge with chef-client 12.0.1 and chef 12.0.3 using either chefdk 0.3.6 or 0.3.5
---
driver:
name: vagrant
synced_folders:
- ["/tmp/synced/%{instance_name}", "/tmp/synced", "create: true"]
provisioner:
name: chef_zero
require_chef_omnibus: 12.0.1