每天充电半小时之Cobbler(16)

Command Line Search

命令行搜索可用于查询Cobbler配置的问题,而不需要使用“cobbler list”或“cobbler report”并过滤结果。

命令行搜索适用于所有发行版/配置文件/系统/repo对象。

cobbler distro find --help
cobbler profile find --help
cobbler system find --help
cobbler repo find --help

例子

查找具有给定mac地址的系统记录。

cobbler system find --mac=AA:BB:CC:DD:EE:FF

如果有某个发行版正在使用某个内核,请删除该对象及其所有子对象(配置文件,系统等)。

cobbler distro find --kernel=/path/to/kernel | xargs -n1 \
--replace cobbler distro remove --name={} --recursive

查询哪些配置文件归neo 和 mranderson所有。

cobbler profile find --owners="neo,mranderson"

查询哪些系统设置了内核参数“color = red”。

cobbler system find --kopts="color=red"

查询哪些系统设置了内核参数“color = red”和“number = 5”。

cobbler system find --kopts="color=red number=5

查询哪些系统将foo的kickstart元数据变量设置为值'bar'。 

cobbler system find --ksmeta="foo=bar"

查询哪些系统设置为netboot-enabled=0。

cobbler system find --netboot-enabled=0

关于类型和通配符的注释

如果为一个参数指定了多个术语,则搜索条件是“AND”关系。

如果指定了多个参数,则搜索条件是“AND”关系。

所有以字符串foo开头的系统:

cobbler system find --name="foo*"

当与xargs结合使用时,这非常有用。报告以“TEST”开头的所有系统。

cobbler system find --name="TEST*" | xargs -n1 --replace cobbler system report --name={}

猜你喜欢

转载自blog.csdn.net/weixin_40042382/article/details/81710969