Initial Chef repository

This commit is contained in:
Greg Karékinian
2015-07-21 19:45:23 +02:00
parent 7e5401fc71
commit ee4079fa85
1151 changed files with 185163 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
# Generated by Chef. Local modifications will be overwritten.
<% @db_info.each do |env,db| -%>
# Privileges for databases in <%= env %>
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'localhost' IDENTIFIED BY '<%= db['password'] %>';
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'<%= node['fqdn'] %>' IDENTIFIED BY '<%= db['password'] %>';
GRANT ALL ON <%= db['database'] %>.* TO '<%= db['username'] %>'@'%' IDENTIFIED BY '<%= db['password'] %>';
<% end -%>
flush privileges;

View File

@@ -0,0 +1,3 @@
AWS_ACCESS_KEY_ID=<%= @access_key %>
AWS_SECRET_ACCESS_KEY=<%= @secret_key %>
BUCKET_BASE_NAME=db-backups

View File

@@ -0,0 +1,6 @@
# Managed by Chef
# m h dom mon dow command
# Keep 1 day of hourly snapshots
PATH=/usr/sbin:/usr/bin:/sbin:/bin
<% cs = "chef-solo -j #{@json_attribs} -c #{@config_file}" %>
<%= @schedule %> root <%= cs %>

View File

@@ -0,0 +1 @@
<%= require 'json'; JSON.pretty_generate(@output) %>

View File

@@ -0,0 +1,6 @@
executable_path ENV['PATH'] ? ENV['PATH'].split(File::PATH_SEPARATOR) : []
<% if @cookbook_path.is_a? Array %>
cookbook_path [ <%= @cookbook_path.collect { |cb| "\"#{cb}\""}.join(", ") -%> ]
<% else %>
cookbook_path "<%= @cookbook_path -%>"
<% end %>

View File

@@ -0,0 +1,2 @@
# Chef Name: ebs_db_backup
15 0 * * * root /usr/local/bin/db-backup.sh

View File

@@ -0,0 +1,8 @@
#!/bin/bash
#
# Back up a MySQL database via EBS snapshot
. /mnt/aws-config/config
/opt/ec2_mysql/bin/ec2_mysql -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY -p '<%= @mysql_root_passwd %>' -k 5 master
echo "done"

View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# Restore a MySQL database from EBS
mkdir -p /mnt/restore
. /mnt/aws-config/config
/opt/ec2_mysql/bin/ec2_mysql -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY -p '<%= @mysql_root_password %>' -v '<%= @ebs_vol_id %>' -m /mnt/restore -d <%= @mysql_device %> -r <%= @mysql_device %> -l debug -n slave
echo "done"

View File

@@ -0,0 +1,27 @@
[default]
access_key = <%= @aws['aws_access_key_id'] %>
acl_public = False
bucket_location = US
debug_syncmatch = False
default_mime_type = binary/octet-stream
delete_removed = False
dry_run = False
encrypt = False
force = False
gpg_command = /usr/bin/gpg
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_passphrase =
guess_mime_type = False
host_base = s3.amazonaws.com
host_bucket = %(bucket)s.s3.amazonaws.com
human_readable_sizes = False
preserve_attrs = True
proxy_host =
proxy_port = 0
recv_chunk = 4096
secret_key = <%= @aws['aws_secret_access_key'] %>
send_chunk = 4096
simpledb_host = sdb.amazonaws.com
use_https = True
verbosity = WARNING