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
task :default => 'upload' | |
$stdin.sync = true | |
desc 'upload chef-repos to chefzero vm' | |
task :upload do | |
system('knife cookbook upload --all') | |
system('knife upload environments/ ') | |
system('knife upload roles/ ') | |
end |
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
apt-get -y update | |
apt-get -y install debconf-utils | |
cat <<EOL | debconf-set-selections | |
grub-pc grub-pc/install_devices multiselect /dev/vda | |
grub-pc grub-pc/install_devices_empty boolean false | |
EOL | |
apt-get -y upgrade |
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
> result = shell_out!('ps | grep hogehgoe') | |
Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' | |
---- Begin output of ps | grep hogehgoe ---- | |
STDOUT: | |
STDERR: | |
---- End output of ps | grep hogehgoe ---- | |
Ran ps | grep hogehgoe returned 1 | |
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0/lib/mixlib/shellout.rb:251:in `invalid!' |
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
# chef-apply test.rb | |
Recipe: (chef-apply cookbook)::(chef-apply recipe) | |
* service[test] action nothing (up to date) | |
* file[/tmp/hoge] action create | |
- update content in file /tmp/hoge from 2b795c to 04db98 | |
--- /tmp/hoge 2014-04-15 03:13:48.000000000 +0000 | |
+++ /tmp/.hoge20140415-4288-ulgn9f 2014-04-15 03:15:43.000000000 +0000 | |
@@ -1,2 +1,2 @@ | |
-2014-04-15 03:13:48 +0000 | |
+2014-04-15 03:15:43 +0000 |
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
require 'chamber' | |
env_confs = [ | |
File.expand_path('../../config/environment.yml', __FILE__), | |
File.expand_path('../../config/environment.local.yml', __FILE__) | |
] | |
EnvSettings = Chamber.load files: env_confs | |
app_confs = [ |
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
# -- snip -- | |
if c.host != host | |
c.ssh.close if c.ssh | |
c.host = host | |
## ここでCapybara.app_hostを設定しちゃう。 | |
Capybara.app_host = "http://#{host}" | |
options = Net::SSH::Config.for(c.host) | |
user = options[:user] || Etc.getlogin | |
c.ssh = Net::SSH.start(host, user, options) | |
end |
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
$ chef-client -v | |
Chef: 11.12.4 | |
$ sudo chef-apply cron.rb | |
Recipe: (chef-apply cookbook)::(chef-apply recipe) | |
* cron[at_reboot] action create | |
- add crontab entry for cron[at_reboot] |
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
Ohai.plugin(:Joyent) do | |
%w{ sm_uuid sm_id sm_image sm_image_id sm_image_ver sm_baseimage sm_baseimage_id sm_baseimage_ver sm_pkgsrc }.each do |info| | |
provides "joyent/#{info}" | |
end | |
provides 'virtualization/guest_id' | |
depends 'os', 'platform', 'virtualization' | |
def collect_solaris_guestid | |
command = '/usr/sbin/zoneadm list -p' |
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
curl -XPUT http://localhost:9200/_template/main_template?pretty -d ' { | |
"template" : "logstash-*", | |
"order" : 10, | |
"settings" : { | |
"index.number_of_replicas" : 0 | |
}, | |
"mappings" : { | |
"_default_" : { | |
"numeric_detection" : true | |
} } |
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
bash -c ' | |
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> | |
exists() { | |
if command -v $1 &>/dev/null | |
then | |
return 0 | |
else | |
return 1 | |
fi |
OlderNewer