基本上我想通过类似的东西
scientific-linux-6 HOSTNAME VLAN
然后在%pre中点击一些API来获取我需要将其附加到KS配置的网络信息.如果我有参数,这部分很容易.
最后在%post我想开始一个厨师跑步和引导带到厨师服务器.这也需要知道主机名/域名(基本上有主机名-f不会爆炸),但如果我能完成上述操作,这应该不会太糟糕.可悲的是,这是我最初的目标,但当我意识到我还没有设置主机名时,它失败了.
这是我到目前为止所学到的.
- $cat linux-install/msgs/param.msg
- 09Kernel Parameter Help07
- Some kernel parameters can be specified on the command line and will be
- passed to the running kernel. This does not include options to modules
- such as ethernet cards or devices such as CD-ROM drives.
- To pass an option to the kernel,use the following format:
- 0flinux <options>07
- If a different installation mode is desired,enter it after the option(s).
- For example,to install on a system with 128MB of RAM using expert mode,type the following:
- 0flinux mem=128M expert07
- To pass options to modules,you will need to use the expert mode to disable
- PCI autoprobing. When the installation asks for your device type that needs
- an option or parameter passed to it,there will be a place to type those
- in at that time.
甜!?这意味着在PXE上我可以像……
- scientific-linux-6 linux ARGV_APPEND
对?
然后把事情变成%pre和%post我找到了This presentation and a few other mentions
- Stick this at the top of the %pre section,and it will take anything of the form var=value
- from /proc/cmdline and turn it into a variable you can use directly
- set -- `cat /proc/cmdline`
- for I in $*; do case "$I" in *=*) eval $I;; esac; done
这意味着我可以说
- scientific-linux-6 linux HOSTNAME=foo.example.com,VLAN=ddd
对?
然后在%pre那意味着我可以
点击我的API获取IP,掩码,网关然后将网络更改为类似的东西
- network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0
- --gateway=10.0.2.254 --nameserver=10.0.2.1
如Here所述
然后,我们为我们的厨师 – 客户运行设置了%post.
我的问题是.这听起来有效吗?有没有更好的办法?当然其他人以前做过这件事吗?
更新(根据答案实施的解决方案)
在PXE命令行上,我最终传递了选项
- $hotBox linux prefix_varname="foo" prefix_another_var="bar"
(linux上的所有内容都放在/ proc / cmdline上.hotBox是PXE标签.)
然后在%post中我解析/ proc / cmdline(在Ruby中)寻找匹配/前缀_ * /的所有变量
并将它们变成哈希.这导致将其从厨师处传递出去,以便根据Web请求的结果进行进一步配置.
注意:当我做完所有这些时,Razor不在身边.我个人对剃刀不满意,我们仍在使用或多或少的上述方法.
解决方法
1)是的,听起来这会起作用.我用kickstart和/ proc / cmdline完成了类似的事情.
2)不,我不相信有更好的方法.内核在/ proc / cmdline中公开其命令行选项,并且kickstart不提供任何用于处理内核命令行选项的高级机制.
3)是的,这是以前做过的.尝试一下,如果你不能使它恢复,请回来.
一些额外的想法:
1)不要在命令行选项之间加上逗号(只需用空格分隔它们).
2)使用pxelinux,使用追加线会很有帮助.例如:
- append initrd=f16-x86_64/initrd.img ks=nfs:server.example.com:/path/to/f16.ks mycustomflag mykey=myval
3)DHCP通常可以更好地为网络设置(例如您提供的主机名示例)提供服务.