我正在尝试让“puppet 设备”功能用于配置思科交换机。我遇到的问题是,我的主控中有一个带有签名证书的思科 2960。该设备位于 site.pp 和 devices.conf 中。我使用正确的 puppetmaster 作为 --server 调用 puppet 设备。我可以在路由器历史记录中看到它实际上正在连接并运行前两个命令,但是 puppet 返回并显示“错误:无法检索本地事实:远程主机关闭连接”。我在交换机配置中也找不到任何会导致这种情况的东西,除了 SSH 和启用密码外,它基本上没有配置。我已确认所有相关主机名都正确解析,密码也正确。
我还进入了 puppet/utils/network_devices/transport/ssh.rb 并强制使用 prettyprint 打印 ssh 输出(因为尽管其中有代码,但它似乎并不尊重 --verbose),它会从 puppet 运行的前 4 行(终端长度 0、启用、sh vlan brief、sh ver)中踢出输出,我还可以编辑 facts.rb 以踢出“facts”变量,它确实包含数据。
相关文件包含如下:
puppet --version:3.1.1 net-ssh 版本:2.6.7
命令行:puppet device --debug --verbose --server puppet.internal.domain
相关输出:
Debug: Finishing transaction 70266566593300
Debug: command
Debug: connecting to switchname.internal.domain as puppet
Error: Could not retrieve local facts: connection closed by remote host
Error: Failed to apply catalog: Could not retrieve local facts: connection closed by remote host
Debug: Value of 'preferred_serialization_format' (pson) is invalid for report, using default (b64_zlib_yaml)
Debug: report supports formats: b64_zlib_yaml raw yaml; using b64_zlib_yaml
puppet.conf
devicedir = /bollocks #(yeah the rhel 6 packages from puppetlabs are broken, had to move this due to permission issues)
color = none
[main]
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl
[agent]
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig
设备配置文件
[switch.internal.domain]
type cisco
url ssh://puppet:[email protected]/?enable=password
site.pp #这还没有真正应用,但它在这里是为了完整性
node "switch.internal.domain" {
interface {"GigabitEthernet0/2":
description => "Hello World",
}
}
交换机配置:
!
version 15.0
no service pad
service timestamps debug uptime
service timestamps log uptime
service password-encryption
!
hostname infra-sw06
!
boot-start-marker
boot-end-marker
!
enable secret 4 LcV6aBcc/53FoCJjXQMd7rBUDEpeevrK8V5jQVoJEhU #password
!
username puppet privilege 15 password 7 055E2A1C0B54471C3E #puppet
aaa new-model
!
!
aaa authentication login CONSOLE line
aaa authentication enable default enable
!
!
!
!
!
!
aaa session-id common
system mtu routing 1500
!
!
ip domain-name switch.internal.domain
!
!
crypto pki trustpoint TP-self-signed-713306880
enrollment selfsigned
subject-name cn=IOS-Self-Signed-Certificate-713306880
revocation-check none
rsakeypair TP-self-signed-713306880
!
!
crypto pki certificate chain TP-self-signed-713306880
certificate self-signed 01
30820229 30820192 A0030201 02020101 300D0609 2A864886 F70D0101 05050030
30312E30 2C060355 04031325 494F532D 53656C66 2D536967 6E65642D 43657274
69666963 6174652D 37313333 30363838 30301E17 0D393330 33303130 30303231
365A170D 32303031 30313030 30303030 5A303031 2E302C06 03550403 1325494F
532D5365 6C662D53 69676E65 642D4365 72746966 69636174 652D3731 33333036
38383030 819F300D 06092A86 4886F70D 01010105 0003818D 00308189 02818100
BBC9A195 E8B6B18B 14F3A70C 54AF3D0F 813DA933 044C4364 B7C975A1 B29E6F4A
871D06AD D7CC8FBF 053EF3B2 BADE30B9 CE31BE4B C9906025 2AEA1930 12BD63E0
3569BBBB 705105E9 7897BE1B EFE96F37 FAD909BC 46100E35 C6EFC1A6 31A072CC
20857391 76A2A387 40ACFEF6 DE756394 603C47FE 14EC5A3F 21EB17FD 9434A129
02030100 01A35330 51300F06 03551D13 0101FF04 05300301 01FF301F 0603551D
23041830 16801411 E123DCC7 610C0B59 ED6C8C4A ED3BA025 4B5E6930 1D060355
1D0E0416 041411E1 23DCC761 0C0B59ED 6C8C4AED 3BA0254B 5E69300D 06092A86
4886F70D 01010505 00038181 00611012 EC921E96 182CCE34 7500BA85 887C8F15
83C17157 680B4F09 217B974E 78437407 D30D20A6 CC962DB6 B7164F12 56A0897D
04511E89 71BC3D8B ED50588B 364FF062 55D3D8A7 5F41541C B55488A3 91262714
185069BF C355D263 A359BF71 0B4E571C CC7A7BFD B8BACAC3 5CF4AB81 05D02EE2
D9E49A95 89A71B95 C34ECBBE 57
quit
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
!
!
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface GigabitEthernet0/3
!
interface GigabitEthernet0/4
!
interface GigabitEthernet0/5
!
interface GigabitEthernet0/6
!
interface GigabitEthernet0/7
!
interface GigabitEthernet0/8
!
interface GigabitEthernet0/9
!
interface GigabitEthernet0/10
!
interface GigabitEthernet0/11
!
interface GigabitEthernet0/12
!
interface GigabitEthernet0/13
!
interface GigabitEthernet0/14
!
interface GigabitEthernet0/15
!
interface GigabitEthernet0/16
!
interface GigabitEthernet0/17
!
interface GigabitEthernet0/18
!
interface GigabitEthernet0/19
!
interface GigabitEthernet0/20
!
interface GigabitEthernet0/21
!
interface GigabitEthernet0/22
!
interface GigabitEthernet0/23
!
interface GigabitEthernet0/24
!
interface GigabitEthernet0/25
!
interface GigabitEthernet0/26
!
interface GigabitEthernet0/27
!
interface GigabitEthernet0/28
!
interface GigabitEthernet0/29
!
interface GigabitEthernet0/30
!
interface GigabitEthernet0/31
!
interface GigabitEthernet0/32
!
interface GigabitEthernet0/33
!
interface GigabitEthernet0/34
!
interface GigabitEthernet0/35
!
interface GigabitEthernet0/36
!
interface GigabitEthernet0/37
!
interface GigabitEthernet0/38
!
interface GigabitEthernet0/39
!
interface GigabitEthernet0/40
!
interface GigabitEthernet0/41
!
interface GigabitEthernet0/42
!
interface GigabitEthernet0/43
!
interface GigabitEthernet0/44
!
interface GigabitEthernet0/45
!
interface GigabitEthernet0/46
!
interface GigabitEthernet0/47
!
interface GigabitEthernet0/48
!
interface Vlan1
ip address <scrubbed> 255.255.255.0
no ip route-cache
!
ip default-gateway <scrubbed>
no ip http server
ip http secure-server
!
!
!
!
line con 0
password 7 <scrubbed>
login authentication CONSOLE
line vty 0 4
transport input ssh
line vty 5 15
transport input ssh
!
end
答案1
我认为我找到了!尝试降级您的 net-ssh gem。据我所知,较新的版本包含更多 puppet 代码未涵盖的异常。对于 puppet 3.2,我恢复到 net-ssh (2.1.4),它似乎已修复该问题。