Last active
December 12, 2015 07:38
-
-
Save ejsarge/4737517 to your computer and use it in GitHub Desktop.
Ubuntu user data for bootstrapping chef with the omnibus installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
curl -L https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 10.18.2 | |
mkdir -p /var/log/chef | |
mkdir -p /var/backups/chef | |
mkdir -p /var/run/chef | |
mkdir -p /var/cache/chef | |
mkdir -p /var/lib/chef | |
mkdir /etc/chef | |
cat - >/etc/chef/bootstrap.json <<EOF | |
{ | |
"run_list": [ | |
"role[base]" | |
], | |
"default_attributes": { | |
}, | |
"override_attributes": { | |
} | |
} | |
EOF | |
cat - >/etc/chef/client.rb <<EOF | |
log_level :info | |
log_location "/var/log/chef/client.log" | |
ssl_verify_mode :verify_none | |
validation_client_name "trailhunger-validator" | |
validation_key "/etc/chef/validation.pem" | |
client_key "/etc/chef/client.pem" | |
chef_server_url "https://api.opscode.com/organizations/trailhunger" | |
file_cache_path "/var/cache/chef" | |
file_backup_path "/var/backups/chef" | |
pid_file "/var/run/chef/client.pid" | |
node_name "`curl http://169.254.169.254/latest/meta-data/instance-id`" | |
Chef::Log::Formatter.show_time = true | |
EOF | |
cat - >/etc/chef/validation.pem <<EOF | |
-----BEGIN RSA PRIVATE KEY----- | |
-----END RSA PRIVATE KEY----- | |
EOF | |
/usr/bin/chef-client -j /etc/chef/bootstrap.json -E prod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment