简体   繁体   English

如何组织全自动安装 (FAI) 类主机?

[英]How to organise Fully Automated Install (FAI) class hosts?

Fully Automated Install (FAI) has hosts in the file 50-host-classes.全自动安装 (FAI) 在文件 50-host-classes 中有主机。 We currently have a bunch of hosts which have similar names (eg, ba-hostxx.subdomain).我们目前有一堆名称相似的主机(例如,ba-hostxx.subdomain)。 The sub-domains are different but one cannot specify host.subdomain in the class file as the '.'子域不同,但不能在类文件中将 host.subdomain 指定为“。” is invalid.是无效的。

Is it possible to have different hosts in different files?是否可以在不同的文件中有不同的主机? Or to specify the host in some other fashion than just或者以其他方式指定主机,而不仅仅是

hostname*)
    echo "BASEFILE FILE" ;;

such as

cluster/hostname*)

    echo "BASEFILE FILE" ;;

? ?

The documentation leads one to the opinion that all hosts sit in the 50- file.该文档导致人们认为所有主机都位于 50- 文件中。

You can create any number of scripts in the $FAI/class/ folder to generate classes for the hosts.您可以在 $FAI/class/ 文件夹中创建任意数量的脚本来为主机生成类。 They just need to print out the correct class name(s) based on your criteria.他们只需要根据您的标准打印出正确的类名。 Example below.下面的例子。

class/51-more-classes类/51-更多类

#!/bin/bash

# Check the domain name for the host
host_domain=`hostname -A|cut -f 2- -d .`
if [ -n "$host_domain" ] ; then
    [ $host_domain = domain-a.foo ] && echo DOMAIN_A 
    [ $host_domain = domain-b.foo ] && echo DOMAIN_B
fi

# just check the host name
[ $HOSTNAME = ba-host76 ] && echo BA_THING
[ $HOSTNAME = qf-host76 ] && echo QF_THING

# Check that the host matches a pattern
if echo $HOSTNAME | grep -q 'zz-host[0-9][0-9]' ; then
    echo CARROTS
    # Play the lottery
    [ $RANDOM -lt 16536 ] && echo WINNER
fi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM