定制安装步骤:
- 统计服务器mac地址
- 配置cobbler
- 安装
统计mac地址此处就不赘述了,直接最重要的配置------在 cobbler 的web界面上配置
登录界面,如遇登录不上去输入完整网址如:https://192.168.163.140
账户密码均为cobbler
步骤如下:
同步配置并重启相关服务:
[root@localhost ~]# cobbler sync
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# systemctl restart xinetd
此网页配置文件在以下位置
[root@localhost systems.d]# ls
VM88.json
[root@localhost systems.d]# pwd
/var/lib/cobbler/config/systems.d
复制VM88.json,到网站搜索json美化工具
效果如下
{
"comment": "",
"status": "production",
"kickstart": "/var/lib/cobbler/kickstarts/rhel-7-x86_64.ks",
"name_servers_search": [],
"ks_meta": {},
"kernel_options_post": {},
"image": "",
"redhat_management_key": "<<inherit>>",
"virt_path": "<<inherit>>",
"power_user": "",
"kernel_options": {
"biosdevname": "0",
"net.ifnames": "0"
},
"ctime": 1606205761.083491,
"name_servers": ["114.114.114.114"],
"mtime": 1606205761.083491,
"enable_gpxe": false,
"template_files": {},
"gateway": "192.168.163.1",
"uid": "MTYwNjIwNTc2MS4wODc2NjQwNDguNDMxMzg",
"virt_auto_boot": 0,
"power_type": "ipmitool",
"virt_cpus": "<<inherit>>",
"mgmt_parameters": "<<inherit>>",
"boot_files": {},
"hostname": "88",
"repos_enabled": false,
"mgmt_classes": [],
"power_pass": "",
"netboot_enabled": true,
"ipv6_autoconfiguration": false,
"profile": "centos-7-x86_64",
"virt_type": "xenpv",
"interfaces": {
"eth88": {
"ipv6_address": "",
"interface_type": "",
"static": true,
"cnames": [],
"mtu": "",
"management": false,
"interface_master": "",
"mac_address": "00:50:56:30:1E:A5",
"ipv6_prefix": "",
"virt_bridge": "xenbr0",
"netmask": "255.255.255.0",
"bonding_opts": "",
"ip_address": "192.168.163.88",
"dhcp_tag": "",
"static_routes": [],
"ipv6_mtu": "",
"ipv6_static_routes": [],
"if_gateway": "",
"dns_name": "",
"bridge_opts": "",
"connected_mode": false,
"ipv6_secondaries": [],
"ipv6_default_gateway": ""
}
},
"power_address": "",
"proxy": "<<inherit>>",
"fetchable_files": {},
"virt_file_size": "<<inherit>>",
"ldap_enabled": false,
"monit_enabled": false,
"ipv6_default_device": "",
"virt_pxe_boot": 0,
"virt_disk_driver": "<<inherit>>",
"owners": "<<inherit>>",
"name": "VM88",
"virt_ram": "<<inherit>>",
"power_id": "",
"server": "<<inherit>>",
"redhat_management_server": "<<inherit>>",
"depth": 2,
"ldap_type": "authconfig",
"template_remote_kickstarts": 0
}
在此基础上写脚本,这里暂时写死看效果
[root@localhost scripts]# cat cobbler_create_system.sh
#!/bin/bash
cat > /var/lib/cobbler/config/systems.d/VM88.json <<EOF
{
"comment": "",
"status": "production",
"kickstart": "/var/lib/cobbler/kickstarts/rhel-7-x86_64.ks",
"name_servers_search": [],
"ks_meta": {},
"kernel_options_post": {},
"image": "",
"redhat_management_key": "<<inherit>>",
"virt_path": "<<inherit>>",
"power_user": "",
"kernel_options": {
"biosdevname": "0",
"net.ifnames": "0"
},
"ctime": 1606205761.083491,
"name_servers": ["114.114.114.114"],
"mtime": 1606205761.083491,
"enable_gpxe": false,
"template_files": {},
"gateway": "192.168.163.1",
"uid": "MTYwNjIwNTc2MS4wODc2NjQwNDguNDMxMzg",
"virt_auto_boot": 0,
"power_type": "ipmitool",
"virt_cpus": "<<inherit>>",
"mgmt_parameters": "<<inherit>>",
"boot_files": {},
"hostname": "88",
"repos_enabled": false,
"mgmt_classes": [],
"power_pass": "",
"netboot_enabled": true,
"ipv6_autoconfiguration": false,
"profile": "centos-7-x86_64",
"virt_type": "xenpv",
"interfaces": {
"eth88": {
"ipv6_address": "",
"interface_type": "",
"static": true,
"cnames": [],
"mtu": "",
"management": false,
"interface_master": "",
"mac_address": "00:50:56:30:1E:A5",
"ipv6_prefix": "",
"virt_bridge": "xenbr0",
"netmask": "255.255.255.0",
"bonding_opts": "",
"ip_address": "192.168.163.88",
"dhcp_tag": "",
"static_routes": [],
"ipv6_mtu": "",
"ipv6_static_routes": [],
"if_gateway": "",
"dns_name": "",
"bridge_opts": "",
"connected_mode": false,
"ipv6_secondaries": [],
"ipv6_default_gateway": ""
}
},
"power_address": "",
"proxy": "<<inherit>>",
"fetchable_files": {},
"virt_file_size": "<<inherit>>",
"ldap_enabled": false,
"monit_enabled": false,
"ipv6_default_device": "",
"virt_pxe_boot": 0,
"virt_disk_driver": "<<inherit>>",
"owners": "<<inherit>>",
"name": "VM88",
"virt_ram": "<<inherit>>",
"power_id": "",
"server": "<<inherit>>",
"redhat_management_server": "<<inherit>>",
"depth": 2,
"ldap_type": "authconfig",
"template_remote_kickstarts": 0
}
EOF
验证