Offline docs (switch to live docs)                         UI-only         CLI-only

About Ansible

Ansible playbooks are now available for MAAS. These extended YAML files automate various routine aspects of MAAS setup and configuration. Automate the drudgery of installing and configuring MAAS with Ansible.

With MAAS 3.3, playbooks are available to install and configure MAAS, including regions and racks. There is also a set of groups that will automate setting up specific sections of MAAS. For example, there is a PostgreSQL group that sets up the primary and secondary PostgreSQL roles, bypassing the need to run both playbooks individually.

After installing Ansible, running each of the playbooks on a blank machine will have a fresh install of MAAS ready to go. For example, running the region+rack will setup a region+rack on the host machine.

Ansible basics

A user should probably have a solid grasp of the Ansible standard terminology:

Ansible is a sophisticated IT automation tool that allows users to set up playbooks, which automate complex, repetitive (or error-prone) setup activities. While we won’t provide a detailed tutorial on Ansible here, there is a bit of terminology you should master before trying to use Ansible with MAAS:

These simple descriptions do not fully explain the terms, so it is worthwhile to consult the referenced links, if necessary, before proceeding. You will also want to understand how Ansible uses the terms “hosts and groups”, since these are applied somewhat differently than we use them in MAAS.

MAAS Ansible playbooks

Playbooks are available to automate the setup for:

MAAS Playbooks will eventually be available through Ansible Galaxy.

There is also a set of groups that will automate setting up specific sections of MAAS. For example, there is a PostgreSQL group that sets up the primary and secondary PostgreSQL roles, bypassing the need to run both playbooks individually. These groups include:

After installing ansible, running each of the playbooks on a blank machine will have a fresh install of MAAS ready to go. For example, running the region+rack will setup a region+rack on the host machine.

Running a MAAS Ansible playbook

In general terms, you can run any of the MAAS Ansible playbookss with a command of this form:

ansible-playbook -i hosts \
--extra_vars \
"maas_version=$MAAS_VERSION 
maas_postgres_password=$MAAS_PG_PASSWORD 
maas_postgres_replication_password=$MAAS_PG_REP_PASSWORD 
maas_installation_type=<deb|snap> 
maas_url=$MAAS_URL" \
./site.yaml

A command of this form will run all of the plays below (i.e., the entire playbook). If you want to run the tasks for one particular role (or roles), you can use the form --tags <target role(s)> to limit which parts of the MAAS Ansible playbook run. Consult the Ansible documentation for more details on additional options and command structure.