我正在尝试使用puppet的networking设备pipe理function来configurationCisco路由器。
我知道它只是运行ios命令,所以如何通过运行我自己的ios命令来扩展它? 我想用这个来创造我自己的事实和做其他的事情。
在Windows端点上,我可以使用exec来运行shell命令:
exec { 'test': command => 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy remotesigned -file C:\test.ps1', }
我怎么能用木偶装置做这样的事情?
当我尝试运行一个IOS命令时,它给了我一个错误:
exec { 'test': command => 'show ip int bri' } Info: Caching catalog for 123.123.123.123 Error: Failed to apply catalog: Validation of Exec[test] failed: 'show ip int bri' is not qualified and no path was specified. Please qualify the command or specify a path. at /etc/puppet/environments/production/modules/ciscorouterconfig/manifests/init.pp:82 shell returned 1
设备资源types的内部工作方式在清单级别不可访问。 interface和vlantypes将其全部抽象出来。
要添加function,您实际上需要添加您自己的types和提供程序。 这需要一些大量的Ruby黑客攻击。 如果你觉得它,你会想看看
将这些扩展插入到模块中可能会很困难,所以实际维护自己的Puppet分支,然后尝试将其合并到上游可能会更直接。
你可以尝试运行这个命令,而不用像下面这样缩短: show ip interface ... ,如果你仍然得到相同的错误,那么我怀疑它不是由puppet-device 。 虽然它是一个类似的实现像一个Linux或Windows框但它有一个非常有限的能力。
你正在得到的错误也听起来像命令不可用。
如果你阅读手册页,它清楚地说:
从puppet master检索所有configuration,并将它们应用到/etc/puppetlabs/puppet/device.conf中configuration的远程设备。
在OPTIONS下你可以阅读:
请注意,在configuration文件中有效的任何设置也是有效的长参数。 例如,'server'是一个有效的configuration参数,所以你可以指定'–server servername'作为参数。
sh ip ...不是可以应用的configuration命令或选项,我想你将无法像这样执行它。