When you need to configure multiple servers it’s always good to look at some configuration management software like Puppet of Chef. But there is a new kid in town and it looks promissing. I’ve played around with Ansible a bit to setup a complex network configration on 5 blade servers running a CentOS minimal. I mentioned this last weekend to Fabian Arrotin last weekend at FOSDEM and he told me to put that info online. So here it is!
Posts Tagged “centos”
Feb 08 2013
Sep 14 2007
In the datacentre I have a Fedora 7 machine with IPMI capabilities. But I have to replace it with CentOS 5.
Hmm. I don’t really want to burn CentOS to a DVD, drive (aprox. 1 hour) to the data centre to reboot the server, place the CentOS installation DVD, run the installation, and drive back to the office. Because all other administration can be done remote through ssh.
So how to start?
The server has two network cards. One attached directly to a switch connected to internet (eth1) and one attached to a seperate switch, which connects all servers in the rack on a private ip-range (eth0)
On the private ip-range I already have dhcp running (not for the servers, they have static ip-addressen, but to make life a bit easier. When I’m with my notebook in the datacentre, I can just plug in, and access all my server through the private lan and also use internet through one gateway with NAT).
Most important here is the next-server and the filename tag.
A tftp server wasn’t installed on this server yet, so I installed it through (it’s fedora core)
Don’t forget to also enable the tftp server in the /etc/xinet.d/tftp file through changing the ‘disable = yes’ to ‘disable = no’
So now the file, which will be downloaded to boot by the server which must install CentOS. pxelinux is maintained by H. Peter Anvin. You have to download syslinux to a temporary directory, unpack it, and copy the pxelinux file to the /tftpboot directory
And now linux kernel to start the CentOS installation
From the CentOS mirror file server you can download special vmlinuz and initrd.img files, which can be used for starting the CentOS installation.
And configuring the pxelinux to start the CentOS installation kernel
After pxelinux is loaded on the booting server, it will try to retrieve a config file from the tftpserver which holds the next steps to take. It will try different files, based on (for instance) the mac-address, IP addres, or a part of the IP address. This way you could setup different kernels to load for different computers or ip ranges. I don’t use that here, so I just place one default config file as /tftpboot/pxelinux.cfg/default with the following content:
The extra parameters behind the append are needed by anaconda, to pass phase 1 of the installation without any questions. Then the installation starts an X-server to start phase 2 (the graphical part). This X-server also support vnc :) So with the configuration above, the X-server will be started with VNC, waiting for you to connect to it’s ip-address with the mentioned password. From that stage, you will see the graphical installation on your local computer (where the VNC viewer is running).
Do the magic
So we’ve got everything in place now. Time to do the magic!
With IPMI I also have the possibility of Serial-Over-Lan. This gives me the opportunity to change settings inside the BIOS through the IPMI card located in the server and listening on the first networkcard.
So after I changes the bootorder in the BIOS, saved the settings and rebooted the machine, I could see in logfile of the dhcp server, that the machine gets a dynamic ip-addres. After that the configfile and kernel files are downloaded from the tftp server. Then it takes a moment to start the phase 1 of the installation, places a second dhcp request (this time by the OS, not by the BIOS/LAN card). Then it checks if it can reach the installation files from the method given in the pxelinux.cfg/default config file. The X-server with vns is started. Then you can connect with a vnc viewer to the dynamic ip-address.