Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

(feat): initial playbook changes for deploy of MaaS stack on Ubuntu 22.04 #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# MAAS-ansible-playbook
An Ansible playbook for installing and configuring MAAS, further documentation is found [here](https://maas.io/docs/ansible-playbooks-reference).
This was forked from: git clone [email protected]:maas/maas-ansible-playbook as the upstream playbook is no longer supported by ansible

## Versions
This playbook has been tested with Ansible version 5.10.0 and above. We recommend using the latest available stable version of Ansible (currently 7.x). The `netaddr` Python library needs to be installed on the machine on which Ansible is used; note that this is not required on remote hosts.

## Install

```
git clone [email protected]:maas/maas-ansible-playbook
git clone [email protected]:singlestore/maas-ansible-playbook
```

## Setup
Expand Down Expand Up @@ -192,19 +193,33 @@ The following variables are only required when using HA Postgres:
### Deploy the MAAS stack

```
ansible-playbook -i ./hosts\
--extra-vars="maas_version=3.2 maas_postgres_password=example maas_installation_type=deb maas_url=http://example.com:5240/MAAS"\
cd maas-ansible-playbook
ansible-playbook -i ./<hosts_filename>.yaml \
--extra-vars="maas_version=3.4 \
maas_postgres_action=install \
maas_postgres_user=maas \
maas_postgres_database=anvil \
maas_postgres_v4_subnet=<ipv4_address of primary postgres host> \
maas_postgres_v6_subnet=<ipv6_address of primary postgres host> \
maas_postgres_password=<postgres_passwd> \
maas_installation_type=snap \
maas_url=http://<ip_addr_of_regiond_controller>/MAAS" \
./site.yaml
```

### Deploy the MAAS stack with Observability enabled

```
ansible-playbook -i ./hosts \
--extra-vars="maas_version=3.3 \
maas_postgres_password=example \
ansible-playbook -i ./<hosts_filename> \
--extra-vars="maas_version=3.4 \
maas_postgres_action=install \
maas_postgres_user=maas \
maas_postgres_database=anvil \
maas_postgres_v4_subnet=<ipv4_address of primary postgres host> \
maas_postgres_v6_subnet=<ipv6_address of primary postgres host> \
maas_postgres_password=<postgres_passwd> \
maas_installation_type=snap \
maas_url=http://example.com:5240/MAAS \
maas_url=http://<ip_addr_of_regiond_controller>/MAAS" \
o11y_enable=true \
o11y_prometheus_url=http://prometheus-server:9090/api/v1/write \
o11y_loki_url=http://loki-server:3100/loki/api/v1/push" \
Expand Down Expand Up @@ -250,3 +265,7 @@ MAAS has a curated collection of alert rules for Prometheus and Loki. You can ex
```
ansible-playbook --extra-vars="o11y_alertrules_dest=/tmp" ./alertrules.yaml
```

### Playbook Known Issues

* group vars in ./group_vars/all/20-database assume current postgres user is called 'maas'
20 changes: 20 additions & 0 deletions evocative-sjc11-hosts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
all:
children:
maas_pacemaker:
children:
maas_corosync:
hosts:
maas_postgres:
hosts:
18886-sjc11-head-node1:
maas_region_controller:
hosts:
18886-sjc11-firewall-node1:
maas_rack_controller:
hosts:
18886-sjc11-head-node1:
maas_proxy:
hosts:
maas_postgres_proxy:
hosts:
2 changes: 1 addition & 1 deletion roles/maas_postgres/tasks/install_postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ansible.builtin.apt:
name:
- "python3-psycopg2"
- "acl"
# - "acl"
- "{{ maas_postgres_deb_name }}"
update_cache: true
cache_valid_time: 3600
Expand Down
5 changes: 0 additions & 5 deletions roles/maas_postgres/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
ansible.builtin.include_tasks:
file: install_postgres.yaml

- name: "Create Replication User"
ansible.builtin.include_tasks:
file: create_replication_user.yaml
when: maas_ha_postgres_enabled and (inventory_hostname == groups["maas_postgres"][0])

- name: "Configure Postgres as a secondary"
ansible.builtin.include_tasks:
file: configure_postgres_secondary.yaml
Expand Down
16 changes: 8 additions & 8 deletions roles/maas_region_controller/tasks/install_maas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@
index_var: idx
when: maas_ha_postgres_enabled|bool

- name: Migrate MAAS database
ansible.builtin.command: "{{ 'maas' if maas_installation_type | lower == 'snap' else 'maas-region' }} migrate"
changed_when: false
register: pg_migrate
until: pg_migrate is not failed
retries: 1
delay: 2
run_once: true
#- name: Migrate MAAS database
# ansible.builtin.command: "{{ 'maas' if maas_installation_type | lower == 'snap' else 'maas-region' }} migrate"
# changed_when: false
# register: pg_migrate
# until: pg_migrate is not failed
# retries: 1
# delay: 2
# run_once: true

# MAAS region controller only needs to be initialized in this case if rbac or candid are in use, otherwise the regiond.conf write handles init
- name: Initialise MAAS Controller - Deb
Expand Down
26 changes: 26 additions & 0 deletions site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@
- maas_installation_type is defined
- maas_postgres_password is defined

- debug:
msg: |-
{% for k in _my_vars %}
{{ k }}: {{ lookup('vars', k) }}
{% endfor %}
vars:
_special_vars:
- ansible_dependent_role_names
- ansible_play_batch
- ansible_play_hosts
- ansible_play_hosts_all
- ansible_play_name
- ansible_play_role_names
- ansible_role_names
- environment
- hostvars
- play_hosts
- role_names
_hostvars: "{{ hostvars[inventory_hostname].keys() }}"
_my_vars: "{{ vars.keys()|
difference(_hostvars)|
difference(_special_vars)|
reject('match', '^_.*$')|
list|
sort }}"

- name: "Ensure maas_version is a version string"
ansible.builtin.assert:
fail_msg: "'{{ maas_version }}' is not a valid version number"
Expand Down