Ubuntu MaaS + maas-image-builder + CentOS 6

Ubuntu recently announced support for other operating systems to be deployed with their Metal as a Service provisioning utility.  The hosting company that I work for is primarily a CentOS and Windows shop, so I was curious to experiment with this utility.  While it is still in a testing phase for us, this shows great promise as a replacement for our existing PXE server.

I just used MaaS to successfully install CentOS on one of the nodes in my test network about 30 minutes ago, so bear with me.  This will likely be a working document.

My test setup consists of:

  • A Dell 1950 server performing NAT duties connected to one of our access switches.
  • The other port on the NAT box is connected to my test Cisco switch (not the access switch).  NOTE:  Something that gave me a bit of headache in the beginning was link negotiation between the switch and the interfaces on my servers.  Spanning-tree portfast is your friend.  Initially, I suspected that it was a firmware issue (BMC firmware), but really it was the interfaces not coming up in a timely manner.  I was able to successfully install Ubuntu on other servers that did not have up-to-date BMC firmware.
  • Connected to to the test switch is an Ubuntu server with MaaS installed.
  • Multiple “node” servers (Dell 1950’s of varying specs) are also connected to the test switch.

Installing and getting MaaS up and running is straightforward enough, and Ubuntu’s documentation is sufficient.  Initially, I tried to model my setup after their topology diagram on their site, with a ‘Region Controller’ manipulating satellite ‘Cluster Controllers’.  I may come to back to that (my setup was torn down and rebuilt a few times during this whole process), but for our testing purposes, one MaaS server to start.

I did a couple of Ubuntu installs just to make sure all the vanilla MaaS functionality was working as it should.  Again, for our purposes, an Ubuntu-only provisioning system would not be practical.  The focus then shifted to how to use MaaS to provision CentOS.

I suspect that because this feature is relatively new, there is not a lot of documentation on this subject.

The kind folks over at #maas on freenode directed me to a script on Github.  I was unable to use the script directly, but after close examination discovered something interesting.

command sudo ./bin/build centos amd64 –centos-edition 7

HMMMM.  So I got to googling..  and found this:  maas-image-builder  So, I downloaded it, and poked around a bit.  From the readme:

root@tnewman3:~/maas-image-builder# cat README

Automated building system for tarball images used by the curtin installer.

Supported Operating Systems:
 – CentOS 6 (i386, amd64)
 – CentOS 7 (amd64)
 – RHEL 7 (amd64)

Well that seems really flipping promising.  So, using that previously mentioned script as a template, I issued the following command to install the necessary dependencies:

./bin/build –install-deps

I let that complete, then for the magical part:

./bin/build centos amd64 –centos-edition 6

I should note that we doctored /maas-image-builder/builder/osystems/centos.py to use our own mirrors at  http://dist1.800hosting.com/centos/  This sped up the process considerably.

Basically, an image gets installed into a QEMU VM, a snapshot is taken, and that is the image that MaaS pushes to provision servers.

In the script the author jjasghar suggests grabbing a coffee.  On the hardware that I was using, it took a VERY VERY long time.  Though I can’t say exactly how long it took, because I left the image to bake over night.  It was on 2 hours when I left for the day.

When I came back in the morning, I checked to see if the process had completed, and sure enough:

root@tnewman3:~/maas-image-builder# ls -al build-output/
total 540132
drwxr-xr-x 2 root root      4096 Feb 20 10:17 .
drwxr-xr-x 7 root root      4096 Feb 19 22:02 ..
-rw-r–r– 1 root root 276538776 Feb 19 22:02 centos6-amd64-root-tgz
-rw-r–r– 1 root root 276538776 Feb 20 10:17 centos6-amd64-root-tgz.bak

 (I immediately made a backup of the image just to be safe)

Wonder of wonders, the process completed!

Referring back to centos.rb, the next step is to add the newly created image to the MaaS service itself.  This was achieved by:

root@tnewman3:~# maas root boot-resources create name=centos/centos6 architecture=amd64/generic content@=/root/maas-image-builder/build-output/centos6-amd64-root-tgz

Again, slightly modified from the version in the centos.rb script to use the MaaS user (‘root’) that I had created and to reflect our choice of CentOS 6 and not CentOS 7.

From there, I went into the MaaS options in the web interface, specified ‘CentOS’ as the ‘Default operating system used for deployment’ and CentOS 6.0 the Default OS release used for deployment and went about commissioning and provisioning a server as usual!

I logged in with

root@tnewman3:~# ssh [email protected]

No password is required, as it uses the SSH key that it would normally use for any other provision.

I hope that this write-up of my MaaS CentOS experience is helpful to others and I welcome feedback!  I will update this post with tweaks and modifications as we tailor MaaS to fit into our existing workflow.

TL;DR – It is quite possible to provision CentOS with Ubuntu’s MaaS service.

Non-update Update 4-2-15:
When I was working on this I got kind of consumed by it.  Very intense work on it..  and then..  nuthin.  I am sure we will come back to this at some point.  Thank you very much for all the interest in my post, but at least as of today, this post is not being maintained.  I do hope that Ubuntu/Canonical adds some serious documentation as the MaaS feature matures.


6 responses to “Ubuntu MaaS + maas-image-builder + CentOS 6”

  1. This is the first post I've discovered on creating a CentOS 7 image for MAAS and Curtin.

    Thanks for sharing – it took a ton of digging to find this one.

  2. the repo location changed and the way of building too, you can do like this :

    bzr -Ossl.cert_reqs=none branch lp:maas-image-builder

    sudo apt-get -y install make python-virtualenv

    cd maas-image-builder
    make install-dependencies
    sudo ./bin/maas-image-builder -o centos7-amd64-root-tgz centos
    sudo ./bin/maas-image-builder -o centos6-amd64-root-tgz centos –edition 6

    Thenks for the rest that is really helpfull

  3. In case you need Windows images, you are welcome to try:


    This will probably be merged upstream soon.

  4. This comment has been removed by a blog administrator.

  5. I followed Christian Bayle's steps and have the image build. However, when I tried to import from MAAS, I got this back:

    $ sudo maas my-maas-profile boot-image read name=centos/centos6 architecture=amd64/generic content@=centos6-amd64-root-tgz
    html head
    title 414 Request-URI Too Long /title
    /head body
    Request-URI Too Long
    The requested URL's length exceeds the capacity
    limit for this server
    address Apache/2.4.7 (Ubuntu) Server at Port 80 /address
    /body /html

    it was a HTML file, I removed tags because blog does not allow HTML tags.

    The original post use "boot-resources" and "create" and I was prompted to change to "boot-image" and "read". I am used the latest MAAS (version 1.7.6). Can someone give me some suggestions? Thanks.

  6. Tried configuring MAAS with CentOS image using the blogspot steps, but when I try to deploy a node using the image, I get following error message:

    2015-10-04 10:43:30 [maasserver] ERROR: Unable to identify boot image for (centos/amd64/generic/centos7/commissioning): cluster 'maas' does not have matching boot image.

    Does anyone have any idea on what the issue is?


Leave a Reply

Your email address will not be published. Required fields are marked *