Here are some notes on trials and tribulations for installing Centos via MAAS.
Simple out-of-the-box deployment use case
MAAS is supposed to have built-in support for Centos deployments, but there are some important assumptions:
- Through the UI, MAAS only supports automatic IP assignment to the PXE interface (set the interface to "Auto"). See "Custom Network Config for Centos" below for a workaround.
- Through the UI, MAAS only supports installation of Centos on the first found disk. See "Installing Centos on a 2nd disk" below for a workaround.
If you stick to those assumptions, you should be able to deploy Centos out of the box. But be aware - YMMV.
Using MAAS Curtin Preseed files
MAAS curtin ("Curt Installer") preseed files are needed for most of the workarounds below.
- Background: some useful links on Curtin, preseeds, etc. Note not all these ref's agree in the details (some links are dated but still have useful hints)
- https://insights.ubuntu.com/2017/06/02/customising-maas-installs/
- http://bazaar.launchpad.net/~curtin-dev/curtin/trunk/view/head:/doc/topics/overview.rst
- http://bazaar.launchpad.net/~curtin-dev/curtin/trunk/view/head:/doc/topics/networking.rst
- http://bazaar.launchpad.net/~curtin-dev/curtin/trunk/files/520/examples
- To create a preseed file specific for a particular node, assuming you are deploying Centos 7.0, on the MAAS server create a curtin preseed file for your server, under
#cloud-config
debconf_selections:
maas: |
{{for line in str(curtin_preseed).splitlines()}}
{{line}}
{{endfor}}
late_commands:
maas: [wget, '--no-proxy', '{{node_disable_pxe_url}}', '--post-data', '{{node_disable_pxe_data}}', '-O', '/dev/null']
10_adduser: ["curtin", "in-target", "--", "sh", "-c", "adduser maas"]
20_addpwd: ["curtin", "in-target", "--", "sh", "-c", "echo 'maas:maas'| chpasswd"]
30_addsudo: ["curtin", "in-target", "--", "sh", "-c", "usermod -aG wheel maas"]
showtrace: true
verbosity: 3
Custom Network Config for Centos
By default, MAAS will only deploy Centos with DHCP-assigned addresses, and only to interfaces that request DHCP addresses. To assign static addresses you need to add
40_touch: ["curtin", "in-target", "--", "sh", "-c", "echo 'touch /etc/sysconfig/network' >>/etc/rc.local"] 50_ifconfig_priv-pxe: ["curtin", "in-target", "--", "sh", "-c", "tee -a /etc/rc.local <<'EOG' \ncat <<EOF >/etc/sysconfig/network-scripts/ifcfg-eno1\nBOOTPROTO=static\nDEVICE=eno1\nHWADDR=b8:ca:3a:aa:bb:cc\nNM_CONTROLLED=no\nONBOOT=yes\nTYPE=Ethernet\nUSERCTL=no\nIPADDR=10.5.62.7\nPREFIX=24\nEOF\nEOG"] 51_ifconfig_public: ["curtin", "in-target", "--", "sh", "-c", "tee -a /etc/rc.local <<'EOG' \ncat <<EOF >/etc/sysconfig/network-scripts/ifcfg-eno3\nBOOTPROTO=static\nDEVICE=eno3\nHWADDR=b8:ca:3a:aa:bb:dd\nNM_CONTROLLED=no\nONBOOT=yes\nTYPE=Ethernet\nUSERCTL=no\nIPADDR=206.148.3.200\nGATEWAY=206.148.0.193\nPREFIX=27\nEOF\nEOG"] 52_ifconfig_admin: ["curtin", "in-target", "--", "sh", "-c", "tee -a /etc/rc.local <<'EOG' \ncat <<EOF >/etc/sysconfig/network-scripts/ifcfg-eno4\nBOOTPROTO=static\nDEVICE=eno4\nHWADDR=b8:ca:3a:aa:bb:ee\nNM_CONTROLLED=no\nONBOOT=yes\nTYPE=Ethernet\nUSERCTL=no\nIPADDR=10.5.61.7\nPREFIX=24\nEOF\nEOG"] 53_ifconfig_del_eth0: ["curtin", "in-target", "--", "sh", "-c", "echo 'rm /etc/sysconfig/network-scripts/ifcfg-eth0' >>/etc/rc.local"] 60_network: ["curtin", "in-target", "--", "sh", "-c", "echo 'systemctl restart network' >>/etc/rc.local"] 70_defroute: ["curtin", "in-target", "--", "sh", "-c", "echo 'route add default gw 206.148.0.193' >>/etc/rc.local"] 71_defroute: ["curtin", "in-target", "--", "sh", "-c", "echo 'route del default gw 10.5.62.254' >>/etc/rc.local"] 80_dns: ["curtin", "in-target", "--", "sh", "-c", "echo 'sed -i s/10.5.62.254/8.8.8.8/g /etc/resolv.conf' >>/etc/rc.local"] 99_chmod: ["curtin", "in-target", "--", "sh", "-c", "chmod +x /etc/rc.d/rc.local"]
Installing Centos on a 2nd disk
By default, MAAS only will deploy Centos on the first hard disk it finds. If you have a server with an SSD as sda, which isn't large enough compared to an HDD as sdb, then you will need the following to deploy Centos.
- Assuming you are deploying Centos 7.0, on the MAAS server create a curtin preseed file for your server, under
#cloud-config
debconf_selections:
maas: |
{{for line in str(curtin_preseed).splitlines()}}
{{line}}
{{endfor}}
storage:
version: 1
config:
- id: sdb
type: disk
ptable: msdos
path: /dev/sdb
name: maindisk
- id: sdb-part1
type: partition
device: sdb
size: 1GB
flag: boot
- id: sdb-part1-fs1
type: format
fstype: xfs
label: boot
volume: sdb-part1
- id: sdb-part2
type: partition
device: sdb
size: 800GB
- id: sdb-part2-fs1
type: format
fstype: ext4
label: centos7
volume: sdb-part2
- id: sdb-part2-fs1-mount0
type: mount
path: /
device: sdb-part2-fs1
- id: sdb-part3
type: partition
device: sdb
size: 128GB
label: swap
flag: swap