Hi Team,
I am trying to execute receipe which validate chef environment and role:
Recipe Example:
if (node.chef_environment == “dev” && node.role?(‘api’))
bash "Restarting service" do
code <<-EOF
#Codeblock
EOF
end
end
if (node.chef_environment == “dev” && node.role?(‘web’))
bash "Restarting service" do
code <<-EOF
#Codeblock
EOF
end
end
But while executing my code block is not working.