Ansible - MAAS Management

1 minute read

Several months back I was working quite a bit with MAAS and needed a way to fully automate not only the MAAS deployment but also the management of VMs. In this case they were VMs running on KVM.

So as I am backfilling with posts and catching up on some things that I had intended on sharing this would be one of them.

First thing is to grab the ansible-maas Ansible role if you would like to use that. This role is actually a very basic single host deployment but can easily be adapted to separate out functionality if needed.

Once you have your MAAS deployment completed you are then ready for managing MAAS with what else other than, Ansible of course. Below you will find the templates and playbook used for managing MAAS.

To generate MAAS Ansible inventory you can use the following Jinja2 template:

To generate MAAS related variables based dynamic discovery you can use the following Jinja2 template:

And for the actual MAAS management playbook you can use the following:

Of course there is so much more you can do with this but I really just wanted to share the foundation of the MAAS management here for others if there is ever a need.

Enjoy!

Leave a comment