MAAS---CLI命令使用之machine 配置
1、获取new状态机器信息
以system-id=8re76b 这台机器为例
(1)读取nodes信息
maas admin nodes read|egrep "status_name|hostname"
"hostname": "centos-test",
"status_name": "Ready",
"hostname": "proven-coyote",
"status_name": "New",
"hostname": "ubuntu",
(2)通过id查看机器信息
maas admin nodesreadid=8re76b |grephostname
"hostname": "proven-coyote",
(3)通过主机名查看机器信息
maas admin nodesreadhostname=proven-coyote |grepsystem_id
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
"system_id": "8re76b",
(4)通过mac 地址查看机器信息
maas admin nodes read mac_address=6c:92:bf:3a:28:30|grep hostname
"hostname": "proven-coyote"
2、设置主机名和domain
maas $maasname machine update $system_id hostname=%s domain=%s
3、设置内网静态ip
配置bond
maas %s interfaces create-bond %sname=bond0parents=%smac_address=%sparents=%sbond_mode=802.3adbond_lacp_rate=slowbond_xmit_hash_policy=layer3+4" %(maasname, system_id, id1, mac_address, id2)
修改网卡名字
maas %sinterface update %s%sname=xgbe0"%(maasname, system_id, interface['id'] )
4、commion
maasadmin machine commission8re76b
5、磁盘分区、挂载
commison之后有了storge可以进行磁盘分区和挂载,也可以不进行分区,使用默认的分区挂载
(1)添加块设备
maas admin block-devices create 8re76bname=sdm1model=INSPURserial=66c92bf0001810ef21be0cb108d6000bblock_size=4096size=4194304
(2)设置块设备的文件系统
maas admin block-deviceformat8re76b 35fstype=ext4
(3)设置块设备的挂载点
maas admin block-devicemount8re76b 35 mount_point=/home/disk1
(4)分区
分区大小可以自己设定
maas admin partitionscreate8re76b 38size=419430400
6、deploy
(1)使用默认操作系统安装
maasadmin machine deploy8re76b
(2)选择操作系统deploy
maas admin machine deploy 8re76b distro_series=suse1