Skip to content

Instantly share code, notes, and snippets.

View inokappa's full-sized avatar
😴
zzzzz

Yohei Kawahara inokappa

😴
zzzzz
View GitHub Profile
require 'spec_helper'
describe file('/etc/hosts') do
it { should contain "#{attr[:ip]} #{attr[:host_name]}.example.com #{attr[:host_name]}" }
end
describe file('/etc/hostname') do
it { should contain "#{attr[:host_name]}.example.com" }
end
require 'net/ssh'
include Serverspec::Helper::Ssh
include Serverspec::Helper::DetectOS
include Serverspec::Helper::Attributes
RSpec.configure do |c|
c.path = '/sbin:/usr/sbin'
require 'spec_helper'
describe file('/usr/local/etc/app.conf') do
it { should contain "URL=#{attr[:host_name]}.example.com" }
end
describe port('12345') do
it { should be_listening }
end
package "mysql-server" do
action :install
end
service "mysqld" do
action :start
end
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
cookbook_file "/etc/yum.repos.d/mariadb.repo" do
source "mariadb.repo"
mode 00644
owner "root"
group "root"
end
%w{MariaDB-devel MariaDB-client MariaDB-server}.each do |marias|
package marias do
action :install
#!/bin/bash
/usr/bin/mysqlslap \
--host=localhost \
--port=3306 \
--engine=innodb \
--auto-generate-sql \
--auto-generate-sql-load-type=read \
--auto-generate-sql-add-autoincrement \
--number-char-cols=3 \
cookbook_file "/tmp/bench.sh" do
source "bench.sh"
mode 00755
user root
group root
end
execute "bench_start" do
command "/tmp/bench.sh > /tmp/bench_result"
only_if {File.exists?("/tmp/bench.sh") && File.exists?("/usr/bin/mysqlslap")}
- hosts: test
user: ec2-user
sudo: yes
tasks:
- name: install mysql-server
action: yum pkg=mysql-server state=installed
- name: mysql is running
action: service name=mysqld state=running
require 'spec_helper'
describe package('mysql-server') do
it { should be_installed }
end
describe service('mysqld') do
it { should be_running }
end