Hi,
I am trying to run this
powershell_script "zabbix_agent_run" do
guard_interpreter :powershell_script
code <<-EOH
Set-ItemProperty -Path "HKLM:\\System\\CurrentControlSet\\Services\\Zabbix Agent" -Name ImagePath -Value '"C:\\Program Files\\Zabbix Agent\\zabbix_agentd.exe" --config "C:\\Program Files\\Zabbix Agent\\zabbix_agentd.conf"'
Restart-Service -Name "Zabbix Agent"
EOH
action :run
not_if <<-EOH
$path_of_executable = '#{node['zabbix']['executable_path']}'
(Get-WmiObject win32_service | ?{$_.Name -Like 'Zabbix *' }).PathName -eq $path_of_executable
EOH
subscribes :install,'chocolatey_package[zabbix-agent]', :before
end
But always the set-Itemproperty runs and chef run fails, since the zabbix agent doesn’t exist. I want to install zabbix-agent before. The chocolatey_package[zabbix-agent] is part of another cookbook.
How can I achieve this ?
Regards,
A