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
powershell_script "Install IIS" do | |
code "add-windowsfeature Web-Server" | |
action :run | |
end | |
service "w3svc" do | |
action [:enable, :start ] | |
end | |
#node.default["iis_demo"]["indexfile"] = "Default2.htm" |
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
:sources: | |
- http://<%= node['gem_file']['host'] %>:<%= node['gem_file']['port'] %>/ |
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
# Plugin-specific configurations | |
if Vagrant.has_plugin?('vagrant-cachier') | |
puts 'INFO: Vagrant-cachier plugin detected. Optimizing caches.' | |
config.cache.enable :chef | |
config.cache.enable :apt | |
else | |
puts 'WARN: Vagrant-cachier plugin not detected. Continuing unoptimized.' | |
end | |
if Vagrant.has_plugin?('Omnibus') |
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
# plugins/apache/modules.rb | |
# :ApacheModules good, you might have some other plugin providing modules | |
# and you wouldn't want to overlap on the :Modules namespace. | |
Ohai.plugin(:ApacheModules) do | |
require 'mixlib/shellout' | |
provides "apache/modules" | |
collect_data(:default) do | |
string = Mixlib::ShellOut.new("apachectl -t -D DUMP_MODULES") | |
string.run_command |
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
describe String do | |
it "responds to #to_s" do | |
expect("").to respond_to(:to_s) | |
end | |
it "responds to the correct methods" do | |
[ :to_s, :to_i, :to_f ].each do |method| | |
expect("").to respond_to(method) | |
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
$Server = "VCENTER SERVER" | |
$datacenter = Get-Datacenter -Name "DATACENTER NAME" | |
$cluster = Get-Cluster -Name "CLUSTER NAME" -Location $datacenter | |
$TemplateName = "TEMPLATE NAME" | |
$Template = Get-Template -Name $TemplateName -Location $datacenter | |
$Datastore = Get-DatastoreCluster -Name "DATASTORE NAME" | |
$ResourcePool = Get-ResourcePool -Name "RESOURCE POOL NAME" -Location $cluster | |
$folder = "FOLDER NAME" | |
$vmname = "VM NAME" |
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 'chef/provider' | |
require 'restclient' | |
class Chef | |
class Provider | |
class Artifact < Chef::Provider | |
def load_current_resource | |
@current_resource = Chef::Resource::Artifact.new(new_resource.name) | |
art_user = new_resource.user |
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
# include Windows::Helper from Opscode Windows Cookbook | |
::Chef::Recipe.send(:include, Windows::Helper) | |
# now you can call helper methods like win_friendly_path directly | |
my_batch_file = win_friendly_path( | |
::File.join( node['cookbook']['batch_dir'],'foo.bat')) | |
execute "My batch file" do | |
command my_batch_file | |
creates "e:/logs/my_batch_file.log" |
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
<html> | |
<body> | |
<h1>Hello, <%= node['iis_demo']['greeting'] %>!</h1> | |
<h2>This is server <%= node['hostname']%></h2> | |
<h3>Do you know the capitals of the following countries?</h3> | |
<% @country.each do |item| -%> | |
<p><a href=<%="#{item}"%>.htm><%="#{item}"%></a></p> | |
<% end -%> | |
</body> | |
</html> |
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
<powershell> | |
#https://gist.github.com/vinyar/6735863 | |
# below two commands are known to fail for arbitrary reasons | |
try { winrm quickconfig -q } | |
catch {write-host "winrm quickconfig failed"} | |
try { Enable-PSRemoting -force} | |
catch {write-host "Enable-PSRemoting -force failed"} | |
write-host 'setting up WinRm'; |