Sha256: daaca17d9b449f9c6759c1f1d03f627d1384f9651d5fa35c559291f5a75fc9b6
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
class LinuxGeneric < Oxidized::Model prompt /^(\w.*|\W.*)(:|#) / comment '# ' # add a comment in the final conf def add_comment(comment) "\n###### #{comment} ######\n" end cmd :all do |cfg| cfg.gsub! /^(default (\S+).* (expires) ).*/, '\\1 <redacted>' cfg.cut_both end # show the persistent configuration pre do cfg = add_comment 'THE HOSTNAME' cfg += cmd 'cat /etc/hostname' cfg += add_comment 'THE HOSTS' cfg += cmd 'cat /etc/hosts' cfg += add_comment 'THE INTERFACES' cfg += cmd 'ip link' cfg += add_comment 'RESOLV.CONF' cfg += cmd 'cat /etc/resolv.conf' cfg += add_comment 'IP Routes' cfg += cmd 'ip route' cfg += add_comment 'IPv6 Routes' cfg += cmd 'ip -6 route' cfg += add_comment 'MOTD' cfg += cmd 'cat /etc/motd' cfg += add_comment 'PASSWD' cfg += cmd 'cat /etc/passwd' cfg += add_comment 'GROUP' cfg += cmd 'cat /etc/group' cfg += add_comment 'nsswitch.conf' cfg += cmd 'cat /etc/nsswitch.conf' cfg += add_comment 'VERSION' cfg += cmd 'cat /etc/issue' cfg end cfg :telnet do username /^Username:/ password /^Password:/ end cfg :telnet, :ssh do post_login do if vars(:enable) == true cmd "sudo su -", /^\[sudo\] password/ cmd @node.auth[:password] elsif vars(:enable) cmd "su -", /^Password:/ cmd vars(:enable) end end pre_logout do cmd "exit" if vars(:enable) end pre_logout 'exit' end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oxidized-0.29.0 | lib/oxidized/model/linuxgeneric.rb |
oxidized-0.28.0 | lib/oxidized/model/linuxgeneric.rb |
oxidized-0.27.0 | lib/oxidized/model/linuxgeneric.rb |