From d3c39c67e2c7ded84f01850e900b7852c19cb0db Mon Sep 17 00:00:00 2001 From: sawanoboly Date: Mon, 23 Mar 2015 19:06:48 +0900 Subject: [PATCH] initial commit --- .gitignore | 63 +++++++++++++++++++++++++ Cheffile | 9 ++++ Cheffile.lock | 17 +++++++ Gemfile | 4 ++ Gemfile.lock | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + Vagrantfile | 54 +++++++++++++++++++++ bootstrap.sh | 7 +++ 8 files changed, 283 insertions(+) create mode 100644 .gitignore create mode 100644 Cheffile create mode 100644 Cheffile.lock create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100644 Vagrantfile create mode 100644 bootstrap.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..83406ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# Created by http://www.gitignore.io + +### Vagrant ### +.vagrant/ + + +### Ruby ### +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalisation: +/.bundle/ +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + + +### Packer ### +# Cache objects +packer_cache/ + +# For built boxes +*.box + + +### vim ### +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +*.un~ +Session.vim +.netrwhist +*~ + +## manual add +/files/archives/*.zip +/cookbooks/ +/.envrc diff --git a/Cheffile b/Cheffile new file mode 100644 index 0000000..6d4f1d3 --- /dev/null +++ b/Cheffile @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +#^syntax detection + +site 'http://community.opscode.com/api/v1' + +cookbook 'ark' + +# development +cookbook 'simplelog_handler' diff --git a/Cheffile.lock b/Cheffile.lock new file mode 100644 index 0000000..035672a --- /dev/null +++ b/Cheffile.lock @@ -0,0 +1,17 @@ +SITE + remote: http://community.opscode.com/api/v1 + specs: + 7-zip (1.0.2) + windows (>= 1.2.2) + ark (0.9.0) + 7-zip (>= 0.0.0) + windows (>= 0.0.0) + chef_handler (1.1.6) + simplelog_handler (1.0.0) + windows (1.36.6) + chef_handler (>= 0.0.0) + +DEPENDENCIES + ark (>= 0) + simplelog_handler (>= 0) + diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..9da182c --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +# A sample Gemfile +source "https://rubygems.org" + +gem 'librarian-chef' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..58b7a8e --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,128 @@ +GEM + remote: https://rubygems.org/ + specs: + builder (3.2.2) + chef (12.1.1) + chef-zero (~> 4.0) + diff-lcs (~> 1.2, >= 1.2.4) + erubis (~> 2.7) + ffi-yajl (~> 1.2) + highline (~> 1.6, >= 1.6.9) + mixlib-authentication (~> 1.3) + mixlib-cli (~> 1.4) + mixlib-config (~> 2.0) + mixlib-log (~> 1.3) + mixlib-shellout (>= 2.0.0.rc.0, < 3.0) + net-ssh (~> 2.6) + net-ssh-multi (~> 1.1) + ohai (~> 8.0) + plist (~> 3.1.0) + pry (~> 0.9) + rspec-core (~> 3.2) + rspec-expectations (~> 3.2) + rspec-mocks (~> 3.2) + rspec_junit_formatter (~> 0.2.0) + serverspec (~> 2.7) + specinfra (~> 2.10) + chef-zero (4.0) + ffi-yajl (~> 1.1) + hashie (~> 2.0) + mixlib-log (~> 1.3) + rack + uuidtools (~> 2.1) + coderay (1.1.0) + diff-lcs (1.2.5) + erubis (2.7.0) + ffi (1.9.8) + ffi-yajl (1.4.0) + ffi (~> 1.5) + libyajl2 (~> 1.2) + hashie (2.1.2) + highline (1.7.1) + ipaddress (0.8.0) + librarian (0.1.2) + highline + thor (~> 0.15) + librarian-chef (0.0.4) + chef (>= 0.10) + librarian (~> 0.1.0) + minitar (>= 0.5.2) + libyajl2 (1.2.0) + method_source (0.8.2) + mime-types (2.4.3) + minitar (0.5.4) + mixlib-authentication (1.3.0) + mixlib-log + mixlib-cli (1.5.0) + mixlib-config (2.1.0) + mixlib-log (1.6.0) + mixlib-shellout (2.0.1) + multi_json (1.11.0) + net-dhcp (1.3.2) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (2.9.2) + net-ssh-gateway (1.2.0) + net-ssh (>= 2.6.5) + net-ssh-multi (1.2.0) + net-ssh (>= 2.6.5) + net-ssh-gateway (>= 1.2.0) + ohai (8.1.1) + ffi (~> 1.9) + ffi-yajl (~> 1.1) + ipaddress + mime-types (~> 2.0) + mixlib-cli + mixlib-config (~> 2.0) + mixlib-log + mixlib-shellout (~> 2.0) + net-dhcp + rake (~> 10.1) + systemu (~> 2.6.4) + wmi-lite (~> 1.0) + plist (3.1.0) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + rack (1.6.0) + rake (10.4.2) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.2) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-its (1.2.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) + rspec_junit_formatter (0.2.0) + builder (< 4) + rspec (>= 2, < 4) + rspec-core (!= 2.12.0) + serverspec (2.12.0) + multi_json + rspec (~> 3.0) + rspec-its + specinfra (~> 2.23) + slop (3.6.0) + specinfra (2.24.2) + net-scp + net-ssh + systemu (2.6.5) + thor (0.19.1) + uuidtools (2.1.5) + wmi-lite (1.0.0) + +PLATFORMS + ruby + +DEPENDENCIES + librarian-chef diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf8af0c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# LW1 Moodle diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..861fb17 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,54 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + config.vm.box = "dummy" + config.omnibus.chef_version = :latest + + config.vm.synced_folder ".", "/vagrant", type: "rsync", + rsync__exclude: [ + '.vagrant/', + '.git/', + 'tmp/', + 'packer_cache/' + ] + + ## AWS + config.vm.provider :aws do |aws, override| + aws.access_key_id = ENV['AWS_ACCESS_KEY'] + aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] + aws.keypair_name = ENV['AWS_EC2_KEYPAIR'] + aws.user_data = "#!/bin/bash\nsed -i -e 's/^Defaults.*requiretty/# Defaults requiretty/g' /etc/sudoers" + + aws.region = ENV['AWS_REGION'] + aws.instance_type = 'c3.large' + case ENV['AWS_REGION'] + when 'ap-northeast-1' + aws.ami = 'ami-18869819' # Amazon Linux AMI 2014.09.2 (HVM) + when 'us-east-1' + aws.ami = 'ami-146e2a7c' # Amazon Linux AMI 2014.09.2 (HVM) + else + raise "Unsupported region #{ENV['AWS_REGION']}" + end + + aws.tags = { + 'Name' => 'Moodle 2.8.5 (Develop)' + } + override.ssh.username = "ec2-user" + override.ssh.private_key_path = ENV['AWS_EC2_KEYPASS'] + end + + config.ssh.pty = true + + ## Sction Provisioning + config.vm.provision :shell, :path => "bootstrap.sh" +# config.vm.provision :chef_solo do |chef| +# chef.cookbooks_path = ["cookbooks", "site-cookbooks"] +# chef.add_recipe 'simplelog_handler::default' +# chef.add_recipe 'lw1_moodle::default' +# end + +end diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..8e1ffc1 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,7 @@ +#/usr/bin/env bash + +sudo yum update -y +sudo mkdir -p /etc/chef/ohai/hints/ +sudo touch /etc/chef/ohai/hints/ec2.json +echo '{}' > ./ec2.json +sudo mv ./ec2.json /etc/chef/ohai/hints/ec2.json