I'm starting to learn how develop
I need to install
Ganglia Monitor in some servers (or
nodes in ganglia literature).
So that's why I'm checking if the plataform is
centOS and many others to install the correct package.
The issue is that I have two different
.config files, actually there is only one or two parameters in this
.config file that would differ one from another.
I need help how to detect in which
datacenter that the
server belongs so that I can copy the properly
So far, I was able to develop this script below, but I have some dobut, which are in comments in the code.
# # Cookbook Name:: ganglia # Recipe:: default # # Copyright 2013, Valter Henrique.com # # All rights reserved - Do Not Redistribute # # Installing Ganglia Monitor case node[:platform] when "ubuntu", "debian" package "ganglia-monitor" when "redhat", "centos", "fedora" package "ganglia-gmond" end user "ganglia" end # Setting different .config files case ipaddress # DataCenter #1 # how put more options in the when condition ? A when for /^200.222./ or /^200.223./ ? when /^200.222./ # putting config file cookbook_file "/etc/ganglia/gmond.conf" do owner "root" group "root" mode "0644" source "dc1/gmond.conf" notifies(:restart, "service[gmond]") end #DataCenter #2 when /^216.235./ cookbook_file "/etc/ganglia/gmond.conf" do owner "root" group "root" mode "0644" source "dc2/gmond.conf" notifies(:restart, "service[gmond]") end end
Any suggestion in how I develop this code in a better way ?