Skip to content

Instantly share code, notes, and snippets.

@pcn
Created September 30, 2013 16:45
Show Gist options
  • Select an option

  • Save pcn/6766604 to your computer and use it in GitHub Desktop.

Select an option

Save pcn/6766604 to your computer and use it in GitHub Desktop.
cookbook to set up knewton-specific conf files
# Cookbook Name:: kcb_cassandra
# Description:: Put platform-style config in the platform-style location
# Recipe:: knewton_conf
# Author:: Peter Norton
#
#
# XXX requires configuration from the chef-server to be there for the environment
%w{ aws environment }.each do |path|
directory "#{node["knewton"]["conf_dir"]}/#{path}" do
recursive true
owner "root"
group "root"
mode "0755"
end
end
billing_account = node["sedeploy"]["application"]["account"]
bag_metadata = node["cassandra"]["priam"]["encrypted_databag"]
account_iam_map = Chef::EncryptedDataBagItem.load(
bag_metadata["bag_name"], bag_metadata["bag_item"],
)[billing_account]
iam_yaml = ::YAML::dump(account_iam_map[bag_metadata["iam_username"]])
ruby_block "print iam" do
block do
pp iam_yaml
end
end
cookbook_file "#{node["knewton"]["conf_dir"]}/aws/stack_iam.yml" do
content iam_yaml
source "empty"
owner "root"
group "root"
mode "0644"
end
cookbook_file "/etc/knewton/configuration/environment/platform.yml" do
content ::YAML::dump(node["sedeploy"]["default_attributes"]["platform_environment"])
source "empty"
owner "root"
group "root"
mode "0644"
end
@pcn

pcn commented Sep 30, 2013

Copy link
Copy Markdown
Author

I started using remote_file, but it wants an actual URL in spite of the use case of overriding the content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment