- From: <
>
- To:
- Subject: [chef] Re: Re: Re: RE: Order of Execution of resources in a cookbook
- Date: Mon, 10 Feb 2014 12:19:11 -0800 (PST)
It looks like "script" resources are executing before "powershell_script"
resources.
Also, I don't see any INFO log statement in chef-client log that shows it is
executing "script" resource. Is it expected?
Just to give a little background, each powershell_script resource will be
executed based on the value returned from its corresponding "script" resource
(I am using powershell_out).
Following is the chef-client log:
# Logfile created on 2014-02-10 14:53:16 -0500 by logger.rb/31641
[2014-02-10T14:53:16-05:00] INFO: *** Chef 11.8.2 ***
[2014-02-10T14:53:16-05:00] INFO: Chef-client pid: 3656
[2014-02-10T14:53:25-05:00] WARN: unable to detect ip6address
[2014-02-10T14:54:04-05:00] INFO: Run List is [recipe[powershell],
recipe[ConfigureIIS::configure_iis]]
[2014-02-10T14:54:04-05:00] INFO: Run List expands to [powershell,
ConfigureIIS::configure_iis]
[2014-02-10T14:54:04-05:00] INFO: Starting Chef Run for ChefNode01V.emspa.com
[2014-02-10T14:54:04-05:00] INFO: Running start handlers
[2014-02-10T14:54:04-05:00] INFO: Start handlers complete.
[2014-02-10T14:54:05-05:00] INFO: Loading cookbooks [ConfigureIIS,
chef_handler, powershell, windows]
[2014-02-10T14:54:07-05:00] INFO: Storing updated
cookbooks/ConfigureIIS/recipes/configure_iis.rb in the cache.
[2014-02-10T14:54:07-05:00] INFO: Powershell light-weight provider already
initialized -- overriding!
[2014-02-10T14:54:09-05:00] WARN: PowerShell 2.0 is not supported on this
version of Windows: 6.3.9600
[2014-02-10T14:54:29-05:00] INFO: Processing user[CounselingAdmin] action
create (ConfigureIIS::configure_iis line 49)
[2014-02-10T14:54:29-05:00] INFO: user[CounselingAdmin] created
[2014-02-10T14:54:29-05:00] INFO: Processing group[Administrators] action
modify (ConfigureIIS::configure_iis line 55)
[2014-02-10T14:54:29-05:00] INFO: group[Administrators] modified
[2014-02-10T14:54:29-05:00] INFO: Processing powershell_script[Install_IIS]
action run (ConfigureIIS::configure_iis line 102)
[2014-02-10T14:54:29-05:00] INFO: Processing
powershell_script[Install_ManagementOdata] action run
(ConfigureIIS::configure_iis line 154)
[2014-02-10T14:54:29-05:00] INFO: Processing
powershell_script[Configure_DefaultAppPool] action run
(ConfigureIIS::configure_iis line 227)
[2014-02-10T14:54:31-05:00] INFO: powershell_script[Configure_DefaultAppPool]
ran successfully
[2014-02-10T14:54:31-05:00] INFO: Processing log[4. Run_Installer_Log] action
write (ConfigureIIS::configure_iis line 250)
[2014-02-10T14:54:31-05:00] INFO: Going to run Installer, if not already
installed.
[2014-02-10T14:54:31-05:00] INFO: Processing windows_package[SimulationIQ
Counseling Bundle Installer] action install (ConfigureIIS::configure_iis line
254)
[2014-02-10T14:54:31-05:00] INFO: Installing windows_package[SimulationIQ
Counseling Bundle Installer] version latest
[2014-02-10T14:54:31-05:00] INFO: Starting installation...this could take
awhile.
[2014-02-10T14:56:00-05:00] INFO: Processing
powershell_script[Counseling_WebConfig] action run
(ConfigureIIS::configure_iis
line 266)
[2014-02-10T14:56:03-05:00] INFO: powershell_script[Counseling_WebConfig] ran
successfully
[2014-02-10T14:56:03-05:00] INFO: Processing
powershell_script[CounselingService_WebConfig] action run
(ConfigureIIS::configure_iis line 323)
[2014-02-10T14:56:05-05:00] INFO:
powershell_script[CounselingService_WebConfig] ran successfully
[2014-02-10T14:56:05-05:00] INFO: Processing
powershell_script[Configure_AppPoolAccount_Counseling] action run
(ConfigureIIS::configure_iis line 465)
[2014-02-10T14:56:05-05:00] INFO: Processing
powershell_script[Configure_AppPoolAccount_CounselingService] action run
(ConfigureIIS::configure_iis line 536)
[2014-02-10T14:56:05-05:00] INFO: Processing
powershell_script[Install_DesktopExperience] action run
(ConfigureIIS::configure_iis line 603)
[2014-02-10T14:56:05-05:00] INFO: Processing log[10. Run_Java_Installer_Log]
action write (ConfigureIIS::configure_iis line 622)
[2014-02-10T14:56:05-05:00] INFO: Going to run Java Installer, if not already
installed.
[2014-02-10T14:56:05-05:00] INFO: Processing windows_package[Java_JRE] action
install (ConfigureIIS::configure_iis line 627)
[2014-02-10T14:56:06-05:00] INFO: Processing
powershell_script[Configure_ArcadiaPublisher_Service_Account] action run
(ConfigureIIS::configure_iis line 682)
[2014-02-10T14:56:06-05:00] INFO: Processing
powershell_script[Configure_WowzaMediaServer364_Service_Account] action run
(ConfigureIIS::configure_iis line 745)
[2014-02-10T14:56:07-05:00] INFO: Chef Run complete in 122.595614 seconds
[2014-02-10T14:56:07-05:00] INFO: Running report handlers
[2014-02-10T14:56:07-05:00] INFO: Report handlers complete
[2014-02-10T14:56:07-05:00] INFO: Sending resource update report (run-id:
328c1bad-052d-4a23-9c8c-e7f767f23341)
Following is the custom log created within each script and powershell_script
resource:
########## 02/10/2014 14:54:10 ##########
2014/10/02 14:54:11 ----- 1. Inside Install_IIS_Check ----
2014/10/02 14:54:13 IIS is already installed. Install_IIS step will be
skipped
2014/10/02 14:54:14 ----- 2. Install_ManagementOdata_Check ----
2014/10/02 14:54:16 ManagementOdata is already installed.
Install_ManagementOdata step will be skipped
2014/10/02 14:54:17 ----- 3. DefaultAppPool_Check ----
2014/10/02 14:54:19 Default App Pool Identity Type is not set to Specific
User
2014/10/02 14:54:20 ----- 7. Counseling App Pool Check ----
2014/10/02 14:54:21 Could not find Counseling under Default Web Site
2014/10/02 14:54:22 ----- 8. Counseling App Pool Check ----
2014/10/02 14:54:23 Could not find Counseling Service under Default Web Site
2014/10/02 14:54:24 ----- 9. Desktop-Experience Feature Check ----
2014/10/02 14:54:25 Desktop-Experience is already installed. Step to install
will be skipped
2014/10/02 14:54:26 ----- 11. ArcadiaPublisher Service Check ----
2014/10/02 14:54:27 Could not find ArcadiaPublisher service.
2014/10/02 14:54:28 ----- 12. WowzaMediaServer364 Service Check ----
2014/10/02 14:54:29 Could not find WowzaMediaServer364 service.
2014/10/02 14:54:30 ----- 3-1 Configure_DefaultAppPool ----
2014/10/02 14:56:01 ----- 5. Counseling_WebConfig ----
2014/10/02 14:56:01 Modifying Counseling web config file
2014/10/02 14:56:04 ----- 6. CounselingService_WebConfig ----
2014/10/02 14:56:04 Modifying Counseling Service web config file
Following is my receipe (sanatized!):
#
# Cookbook Name:: ConfigureIIS
# Recipe:: default
#
# Copyright 2014,
#
# All rights reserved - Do Not Redistribute
#
# Include PowershellOut mixin
::Chef::Recipe.send(:include, Chef::Mixin::PowershellOut)
# ---------- Create a Log File ----------
script =<<-EOF
$logFolder = 'C:\\Temp\\'
if(!(test-path $logFolder))
{
New-Item $logFolder -type directory
}
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
if(!(test-path $processLog))
{
New-Item $processLog -type file
}
$currentDate = Get-Date
$str = '########## ' + $currentDate + ' ##########'
Add-Content $processLog "`n"
Add-Content $processLog $str
Add-Content $processLog "`n"
EOF
cmd = powershell_out(script)
#Chef::Log.info(cmd.stdout)
#Chef::Log.info(cmd.stderr)
# ---------- Create Local Admin User ----------
user "**********" do
password "**********"
action :create
end
group "Administrators" do
action :modify
members "**********"
append true
end
# ---------- 1. Install IIS Role, if not already installed ----------
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 1. Inside
Install_IIS_Check ----')
$x = Get-WindowsFeature -name "Web-Server"
$status = 0
if($x -ne $null)
{
$installed = $x.Installed
if($installed -eq $false)
{
Add-Content $processLog (($date=Date) + ' ' + 'IIS is
not installed')
$status = 1
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'IIS is
already installed. Install_IIS step will be skipped')
$status = 0
}
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
#Chef::Log.info("-------------KKS-------------")
#Chef::Log.info(cmd)
#Chef::Log.info(cmd.stdout)
#Chef::Log.info(cmd.stderr)
x = cmd.stdout.chop
#puts "Value of x : " + x
powershell_script "Install_IIS" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 1-1 Inside
Install_IIS ----')
Add-Content $processLog (($date=Date) + ' ' + 'IIS Server role is not
installed ')
#Install-WindowsFeature -name "Web-Server" -IncludeManagementTools
-IncludeAllSubFeature -WhatIf
Install-WindowsFeature -name "Web-Server" -IncludeManagementTools
-IncludeAllSubFeature
EOH
only_if { x == '1' }
end
# ---------- 2. Install IIS ManagementOdata feature, if not already installed
----------
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 2.
Install_ManagementOdata_Check ----')
$x = Get-WindowsFeature -name "ManagementOdata"
$status = 0
if($x -ne $null)
{
$installed = $x.Installed
if($installed -eq $false)
{
Add-Content $processLog (($date=Date) + ' ' +
'ManagementOdata is not installed')
$status = 1
}
else
{
Add-Content $processLog (($date=Date) + ' ' +
'ManagementOdata is already installed. Install_ManagementOdata step will be
skipped')
$status = 0
}
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
y = cmd.stdout.chop
#puts "Value of y : " + y
powershell_script "Install_ManagementOdata" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 2-1
Install_ManagementOdata ----')
Add-Content $processLog (($date=Date) + ' ' + 'Installing Management
OData IIS Extension feature')
Install-WindowsFeature -name "ManagementOdata"
EOH
only_if { y == '1' }
end
# ---------- 3. Set properties of DefaultAppPool, if not already configured
----------
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 3.
DefaultAppPool_Check ----')
$status = 0
try
{
Import-Module WebAdministration
$moduleImported = Get-Module WebAdministration
if($moduleImported -ne $null)
{
$defaultAppPool = Get-WebConfiguration -filter
/system.applicationhost/applicationPools/* | where {$_.name -eq
'DefaultAppPool'}
if($defaultAppPool -ne $null)
{
$identityType =
$defaultAppPool.processModel.identityType
if($identityType -ne 'SpecificUser')
{
Add-Content $processLog (($date=Date)
+
' ' + 'Default App Pool Identity Type is not set to Specific User')
$status = 1
}
else
{
Add-Content $processLog (($date=Date)
+
' ' + 'Default App Pool Identity Type is already set to Specific User. Step
to
set it will be skipped')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' +
'Default App Pool is null')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could
not load WebAdministration PowerShell Module')
}
}
catch
{
Throw $_.Exception
Add-Content $processLog (($date=Date) + ' ' + 'Exception : ' +
$_.Exception)
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
#Chef::Log.info(cmd)
#Chef::Log.info("cmd_stdout : " + cmd.stdout)
#Chef::Log.info("cmd_stderr : " + cmd.stderr)
z = cmd.stdout.chop
#puts "Value of z : " + z
powershell_script "Configure_DefaultAppPool" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 3-1
Configure_DefaultAppPool ----')
Import-Module WebAdministration
$moduleImported = Get-Module WebAdministration
if($moduleImported -ne $null)
{
Set-WebConfiguration -filter
'/system.applicationhost/applicationPools/
"DefaultAppPool"]/processModel'
-Value
(@{identityType="SpecificUser";userName="**********";password="**********";idleTimeout="16:39:00"})
}
Add-Content $processLog "`n"
EOH
only_if { z == '1' }
end
# ---------- 4. Run CounselingInstaller.exe ----------
log "4. Run_Installer_Log" do
message "Going to run Installer, if not already installed."
end
windows_package "Installer" do
source "C:\\Temp\\Installer.exe"
installer_type :custom
action :install
end
# ---------- 5. Modify Counseling web.config file ----------
powershell_script "X_WebConfig" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 5.
Counseling_WebConfig ----')
Add-Content $processLog (($date=Date) + ' ' + 'Modifying Counseling
web config file')
EOH
end
# ---------- 6. Modify Counseling Service web.config file ----------
powershell_script "Y_WebConfig" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 6.
CounselingService_WebConfig ----')
Add-Content $processLog (($date=Date) + ' ' + 'Modifying Counseling
Service web config file')
EOH
end
# ---------- 7. Configure AppPoolAccount for Counseling and CounselingService
applications ----------
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 7. Counseling
App
Pool Check ----')
$status = 0
Import-Module WebAdministration
$moduleImported = Get-Module WebAdministration
if($moduleImported -ne $null)
{
$counselingApp = get-item 'IIS:\\Sites\\Default Web
Site\\Counseling'
if($counselingApp -ne $null)
{
$appPoolAccount = $counselingApp.applicationPool
if($appPoolAccount -ne 'DefaultAppPool')
{
Add-Content $processLog (($date=Date) + ' ' +
'Counseling AppPool is not set to DefaultAppPool')
$status = 1
}
else
{
Add-Content $processLog (($date=Date) + ' ' +
'Counseling AppPool is already set to DefaultAppPool. Step to set it will be
skipped')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could
not find Counseling under Default Web Site')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could not load
WebAdministration PowerShell module')
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
a = cmd.stdout.chop
powershell_script "Configure_AppPoolAccount_Counseling" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 7-1
Configure_AppPoolAccount_Counseling ----')
Add-Content $processLog (($date=Date) + ' ' + 'Configuring App Pool
Account for Counseling Application')
Import-Module WebAdministration
$moduleImported = Get-Module WebAdministration
if($moduleImported -ne $null)
{
Set-ItemProperty 'IIS:\\Sites\\Default Web Site\\Counseling'
applicationPool DefaultAppPool
}
Add-Content $processLog "`n"
EOH
only_if { a == '1' }
end
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 8. Counseling
App
Pool Check ----')
$status = 0
Import-Module WebAdministration
$moduleImported = Get-Module WebAdministration
if($moduleImported -ne $null)
{
$counselingServiceApp = get-item 'IIS:\\Sites\\Default Web
Site\\CounselingService'
if($counselingServiceApp -ne $null)
{
$appPoolAccount =
$counselingServiceApp.applicationPool
if($appPoolAccount -ne 'DefaultAppPool')
{
Add-Content $processLog (($date=Date) + ' ' +
'Counseling Service AppPool is not set to DefaultAppPool')
$status = 1
}
else
{
Add-Content $processLog (($date=Date) + ' ' +
'Counseling Service AppPool is already set to DefaultAppPool. Step to set it
will be skipped')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could
not find Counseling Service under Default Web Site')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could not load
WebAdministration PowerShell module')
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
b = cmd.stdout.chop
powershell_script "Configure_AppPoolAccount_CounselingService" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 8-1
Configure_AppPoolAccount_CounselingService ----')
Add-Content $processLog (($date=Date) + ' ' + 'Configuring App Pool
Account for Counseling Service Application')
Import-Module WebAdministration
$moduleImported = Get-Module WebAdministration
if($moduleImported -ne $null)
{
Set-ItemProperty 'IIS:\\Sites\\Default Web
Site\\CounselingService' applicationPool DefaultAppPool
}
Add-Content $processLog "`n"
EOH
only_if { b == '1' }
end
# ---------- 9. Install Desktop-Experience, if not already installed
----------
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 9.
Desktop-Experience Feature Check ----')
$x = Get-WindowsFeature -name "Desktop-Experience"
$status = 0
if($x -ne $null)
{
$installed = $x.Installed
if($installed -eq $false)
{
Add-Content $processLog (($date=Date) + ' ' +
'Desktop-Experience feature is not installed')
$status = 1
}
else
{
Add-Content $processLog (($date=Date) + ' ' +
'Desktop-Experience is already installed. Step to install will be skipped')
$status = 0
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could not find
a feature by the name Desktop-Experience')
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
m= cmd.stdout.chop
powershell_script "Install_DesktopExperience" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 9-1
Install_DesktopExperience ----')
Add-Content $processLog (($date=Date) + ' ' + 'Installing
Desktop-Experience feature')
Install-WindowsFeature -name "Desktop-Experience"
Add-Content $processLog "`n"
EOH
only_if { m == '1' }
end
# ---------- 10. Install Java JRE ----------
log "10. Run_Java_Installer_Log" do
message "Going to run Java Installer, if not already installed."
end
windows_package "Java_JRE" do
package_name "Java 7 Update 45 (64-bit)"
source "C:\\Temp\\Java\\jre-7u45-windows-x64.exe"
installer_type :custom
action :install
options "/s /L java_setup.log"
end
# ---------- 11. Configure Publisher Service ----------
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 11.
ArcadiaPublisher Service Check ----')
$status = 0
$z = Get-WmiObject Win32_Service | where {$_.Name -eq
'ArcadiaPublisher'}
if($z -ne $null)
{
$startName = $z.StartName
if($startName -eq 'LocalSystem')
{
Add-Content $processLog (($date=Date) + ' ' +
'ArcadiaPublisher service logon account is set to LocalSystem')
$status = 1
}
else
{
Add-Content $processLog (($date=Date) + ' ' +
'ArcadiaPublisher service logon account is not to LocalSystem. Step to set it
to specific account will be skipped')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could not find
ArcadiaPublisher service.')
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
n= cmd.stdout.chop
powershell_script "Configure_ArcadiaPublisher_Service_Account" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 11-1
Configure_ArcadiaPublisher_Service_Account ----')
$cmd = \"sc.exe config ArcadiaPublisher obj= .\\********** password=
**********\"
#Add-Content $processLog (($date=Date) + ' ' + 'SC command : ' +
$cmd)
$execCmd = Invoke-Expression -Command $cmd
Add-Content $processLog (($date=Date) + ' ' + 'SC command output : '
+
$execCmd)
Restart-Service -Name ArcadiaPublisher
Add-Content $processLog "`n"
EOH
only_if { n == '1' }
end
# ---------- 12. Configure WowzaMediaServer364 Service ----------
script =<<-EOF
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 12.
WowzaMediaServer364 Service Check ----')
$status = 0
$z = Get-WmiObject Win32_Service | where {$_.Name -eq
'WowzaMediaServer364'}
if($z -ne $null)
{
$startName = $z.StartName
if($startName -eq 'LocalSystem')
{
Add-Content $processLog (($date=Date) + ' ' +
'WowzaMediaServer364 service logon account is set to LocalSystem')
$status = 1
}
else
{
Add-Content $processLog (($date=Date) + ' ' +
'WowzaMediaServer364 service logon account is not to LocalSystem. Step to set
it to specific account will be skipped')
}
}
else
{
Add-Content $processLog (($date=Date) + ' ' + 'Could not find
WowzaMediaServer364 service.')
}
Add-Content $processLog "`n"
return $status
EOF
cmd = powershell_out(script)
o= cmd.stdout.chop
powershell_script "Configure_WowzaMediaServer364_Service_Account" do
code <<-EOH
$processLog = 'C:\\Temp\\Chef_PS_Log.txt'
function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }
Add-Content $processLog (($date=Date) + ' ' + '----- 12-1
Configure_WowzaMediaServer364_Service_Account ----')
$cmd = \"sc.exe config WowzaMediaServer364 obj= .\\**********
password=
**********\"
#Add-Content $processLog (($date=Date) + ' ' + 'SC command : ' +
$cmd)
$execCmd = Invoke-Expression -Command $cmd
Add-Content $processLog (($date=Date) + ' ' + 'SC command output : '
+
$execCmd)
Restart-Service -Name WowzaMediaServer364
Add-Content $processLog "`n"
EOH
only_if { o == '1' }
end
- [chef] Re: Re: Re: RE: Order of Execution of resources in a cookbook, kapil.shardha, 02/10/2014
Archive powered by MHonArc 2.6.16.