Greetings Pro's
Can any one help me how to resolve this issue , we have a bunch of linux servers with different versions RHEL 6+& 7+ and im trying to install an agent and cloud not able to compile recipe successfully due to commands that differ from rehl 6 and 7 below is the recipe im trying to execute
#######################################################################
execute 'SSMAgent-Install' do
command "yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm"
action :run
end
################################### (1st block execute successfully )
service 'SSMAgent-start' do
if node['platform'] == 'redhat' && node['platform_version'].to_i < 7
execute "SSMAgent" do
command "sudo systemctl enable amazon-ssm-agent"
command "sudo systemctl start amazon-ssm-agent"
action :run
end
else
execute "SSMAgent" do
command "sudo start amazon-ssm-agent"
command "sudo status amazon-ssm-agent"
end
end
end
###########################################( 2nd block fails)
I even tried including uisng service block , but this works only on RHEL7 but not on Rehl version 6
#service 'amazon-ssm-agent' do
#supports [:start, :stop, :restart, :enable]
#action [:start ,:enable]
#ignore_failure true
#end
Please help..!
Thanks
Prash