educatic-info/test/services.rb

26 lines
681 B
Ruby
Executable File

#!/usr/bin/env ruby
require "yaml"
require "colorize"
filename = File.join(File.dirname(__FILE__), "services.yaml")
settings = YAML.load(File.read(filename))
services = settings["services"]
services.each_pair do |key, value|
puts "==> #{key} [#{value['hetzner']}] ".colorize(:white)
cmd = "host #{value['ip']}| grep #{value['hostname']}| wc -l"
counter = %x[#{cmd}].to_i
if counter.zero?
puts " Check this:"
puts " * hostname = #{value['hostname']}"
puts " * ip = #{value['ip']}"
end
unless value['todo'].nil?
puts " TODO:"
value['todo'].each_with_index do |line, index|
puts " #{index + 1}. #{line}"
end
end
end