LoginSignup
1
0

AIXで複数のNIMクライアントを定義ファイルを用いて一括登録する

Posted at

はじめに

AIX の NIM (Network Installation Manager)サーバーに NIM クライアントを登録する際、定義ファイルからコマンドを使用して複数のクライアントを一度で定義する方法を確認しました。

nimdef コマンドを使用します。

nimdef コマンドの使用

nimdef コマンド

nimdef コマンドのサンプル定義ファイル


環境

AIX NIM サーバー(マスター)
 - ファイルセット "bos.sysmgt.nim.master"、"bos.sysmgt.nim.spot" を導入済み


実行方法

/usr/samples/nim/client.defs というサンプル・ファイルを参考にして、
設定に使用する client.defs を作成します。

今回実行で使用する /tmp/client.defs は以下の内容です。
( # コメントアウト部分が多いですが :sweat: )

/tmp/client.defs
# @(#)00 1.5 src/bos/usr/lib/nim/methods/client.defs.sh, cmdnim, bos730, initial_extract 6/2/06 13:47:08
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# bos730 src/bos/usr/lib/nim/methods/client.defs.sh 1.5
#
# Licensed Materials - Property of IBM
#
# COPYRIGHT International Business Machines Corp. 2001
# All Rights Reserved
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# IBM_PROLOG_END_TAG
#                                Sample Client Definition File
#                                *****************************
#       The following is an example of how a Client Definition file should be. Before you run
# nimdef command, please create your own client definition file as per your requirement with
# valid values for the attributes, like machine_type,subnet_mask etc...
#
# For details on nimdef command and client definition file's attributes, please refer to
# NIM installaton guide:
#
# Important Note:
# 1) The hostnames(lpar1,lpar2 etc) given below are examples. You must give the valid
# hostname when you create your own client definition file. Eg: if lpar1 in your environment is
# defined as myhost1.austin.ibm.com,use it in place of lpar1 so that name resolution will be successful.
#
# 2) Do not change the default machine_group value. This is used in add_hosts.
#
# 3) cable_type and ring_type are mutually exclusive.You must specify anyone of them
#    based on the network_type attribute. If network_type is ent, specify cable_type.
#    If it is tok, specify ring_type.
#
# Following are the machine attributes that are used in Client file definition.
#
# Required Attributes
# *******************
# cable_type
# gateway
# machine_type
# network_type
# ring_speed
# subnet_mask
#
# Optional Attributes
# *******************
# nim_name
# platform
# net_adptr_name
# netboot_kernel=NetbootKernelType
# ipl_rom_emulation
# primary_interface
# master_gateway
# machine_group
# comment
#


# set default values
default:
        machine_type = standalone
        subnet_mask  = 255.255.0.0
        gateway      = 172.16.0.0
        network_type = ent
        cable_type   = N/A
        platform     = chrp
        netboot_kernel = 64

# Define the lpar1
# When network type is tok. No cable_type is required.
test1:
test2:

前提として /etc/hosts に対象の NIMクライアントの定義を設定しています。

# cat /etc/hosts | grep test
172.16.100.102 test1
172.16.12.12 test2

上記の出力にはありませんが NIM マスター(自分自身)のホスト定義も実施しています。


nimdefコマンド・プレビュー実行

nimdef コマンドを使用してNIMクライアント定義実行のプレビュー(-pオプション)を実行します。

# nimdef -p -f /tmp/client.defs


2 machine definitions are complete.  The following machines will be
    added to the NIM environment:

  test1:
    hostname=test1
    gateway=172.16.0.0
    subnet_mask=255.255.0.0
    network_type=ent
    cable_type=N/A
    machine_type=standalone
    platform=chrp
    hostaddr=172.16.100.102
    netaddr=172.16.0.0
    netboot_kernel=64
  test2:
    hostname=test2
    gateway=172.16.0.0
    subnet_mask=255.255.0.0
    network_type=ent
    cable_type=N/A
    machine_type=standalone
    platform=chrp
    hostaddr=172.16.12.12
    netaddr=172.16.0.0
    netboot_kernel=64


1 network in the NIM environment will have new machine interfaces added.

  master_net:
    network_type=ent
    address=172.16.0.0
    subnet=255.255.0.0
    hostname=test1
    hostname=test2


Summary

    2  Machines will be added to the NIM environment.
    1  Network will have new NIM machine interfaces added.


############################################################################
#
# Commands to define new machines in the NIM environment.
#
############################################################################
nim -o define -t standalone -a if1="find_net test1 0 ent" -a cable_type1=N/A -a 
net_definition="ent 255.255.0.0 172.16.0.0 " -a netboot_kernel=64 -a platform=chrp test1

nim -o define -t standalone -a if1="find_net test2 0 ent" -a cable_type1=N/A -a 
net_definition="ent 255.255.0.0 172.16.0.0 " -a netboot_kernel=64 -a platform=chrp test2

なるほど、定義ファイルからコマンドを作成して実行されるのですね。


nimdef コマンドで NIM クライアント定義を実行

nimdef コマンドを使用して NIM クライアント定義を実行(-dオプション)します。

# nimdef -d -f /tmp/client.defs
Summary
    2  Machines will be added to the NIM environment.
    1  Network will have new NIM machine interfaces added.

+ nim -o define -t standalone -a if1=find_net test1 0 ent -a cable_type1=N/A -a 
  net_definition=ent 255.255.0.0 172.16.0.0  -a netboot_kernel=64 -a platform=chrp test1
+ nim -o define -t standalone -a if1=find_net test2 0 ent -a cable_type1=N/A -a 
  net_definition=ent 255.255.0.0 172.16.0.0  -a netboot_kernel=64 -a platform=chrp test2

# echo $?
0

エラーなく実施できました。


確認

マシン定義で test1, test2 が作成されているかを確認します。

# lsnim | grep machine
master          machines        master
test1           machines        standalone
test2           machines        standalone

詳細確認...

# lsnim -l test1
test1:
   class          = machines
   type           = standalone
   connect        = nimsh
   platform       = chrp
   netboot_kernel = 64
   if1            = master_net test1 0 ent
   cable_type1    = N/A
   Cstate         = ready for a NIM operation
   prev_state     = ready for a NIM operation
   Mstate         = not running

# lsnim -l test2   
test2:
   class          = machines
   type           = standalone
   connect        = nimsh
   platform       = chrp
   netboot_kernel = 64
   if1            = master_net test2 0 ent
   cable_type1    = N/A
   Cstate         = ready for a NIM operation
   prev_state     = ready for a NIM operation
   Mstate         = not running

無事、作成されています。


おわりに

複数の NIM クライアントを一度で登録することが可能となる nimdef コマンドの実行を確認しました。

以上です。

1
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0