educatic-info/test/services.rb

26 lines
681 B
Ruby
Raw Normal View History

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