This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'chef' | |
| require 'json' | |
| Chef::Config.from_file '.chef/knife.rb' | |
| versions = Hash.new(0) | |
| result = Chef::Search::Query.new.search(:node,"name:*")[0] |
This file contains hidden or 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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| Vagrant::Config.run do |config| | |
| # All Vagrant configuration is done here. The most common configuration | |
| # options are documented and commented below. For a complete reference, | |
| # please see the online documentation at vagrantup.com. | |
| # Every Vagrant virtual environment requires a box to build off of. | |
| config.vm.box = "precise64" |
This file contains hidden or 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
| run_date = Time.now | |
| ruby_block "add current date" do | |
| block do | |
| node[:test_last_chef_run] = run_date.to_i | |
| node.save | |
| end | |
| action :create | |
| end |
This file contains hidden or 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
| def load_roles_and_hosts_from_chef(query) | |
| Chef::Search::Query.new.search(:node,query) do |node| | |
| node_role = node[:platform_role] || "default" | |
| server_name = if defined? user && user && !user.empty? | |
| "#{user}@#{node.name}" | |
| else | |
| node.name | |
| end | |
| if node_role.kind_of? Array | |
| node_role.each do |role| |
This file contains hidden or 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
| execute "pip install yolk" do | |
| not_if { ::File.exists?("/usr/local/bin/yolk") } | |
| end | |
| %w(http://www.vazor.com/media/python-cjson-1.0.6.tar.gz | |
| mysql-python | |
| lxml python-cjson | |
| http://git.dbzteam.org/pyinotify/snapshot/pyinotify-0.8.6.tar.gz | |
| pip pycrypto).each do |pkg| | |
This file contains hidden or 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
| rule "parse host from localhost messages" | |
| when | |
| m : GELFMessage( host == "localhost" ) | |
| then | |
| Matcher matcher = Pattern.compile("([\\w\\.\\-]+)|l=([A-Z_a-z]+)|").matcher(m.getShortMessage()); | |
| if (matcher.find()) { | |
| System.out.println("host: " + matcher.group(1) + " l=" + matcher.group(2)); | |
| m.setHost(matcher.group(1)); | |
| m.addAdditionalData("_level",matcher.group(2)); | |
| } |
This file contains hidden or 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 :queues_to_store, :roles => [:app,:master] do | |
| logger.info "activating queues => store" | |
| run "#{jboss_target_directory}/bin/twiddle.sh -u #{twiddle_user} -p #{twiddle_password} set RunMyProcess:service=Queues AllQueuesStore true" rescue logger.info "Twiddle Error ..." | |
| end | |
| task :no_queues_to_store, :roles => [:app,:master] do | |
| logger.info "de-activating queues => store" | |
| run "#{jboss_target_directory}/bin/twiddle.sh -u #{twiddle_user} -p #{twiddle_password} set RunMyProcess:service=Queues AllQueuesStore false" rescue logger.info "Twiddle Error ..." | |
| end |
This file contains hidden or 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
| i = 0; while i <= 15; print "[#{'=' * i}#{' ' * (15 - i)}] #{((i/15.0) * 100).round}%\r"; i += 1; sleep 0.2; end; puts |
NewerOlder