Closed samuelallan72 closed 1 year ago
diff --git a/roles/maas_region_controller/tasks/install_maas.yaml b/roles/maas_region_controller/tasks/install_maas.yaml
index 8286b5b..8ac2c08 100644
--- a/roles/maas_region_controller/tasks/install_maas.yaml
+++ b/roles/maas_region_controller/tasks/install_maas.yaml
@@ -42,6 +42,7 @@
- name: Migrate MAAS database
ansible.builtin.command: "{{ 'maas' if maas_installation_type | lower == 'snap' else 'maas-region' }} migrate"
changed_when: false
+ run_once: true
# MAAS region controller only needs to be initialized in this case if rbac or candid are in use, otherwise the reigond.conf write handles init
- name: Initialise MAAS Controller - Deb
diff --git a/roles/maas_region_controller/tasks/update_maas.yaml b/roles/maas_region_controller/tasks/update_maas.yaml
index 3e12c0d..975daeb 100644
--- a/roles/maas_region_controller/tasks/update_maas.yaml
+++ b/roles/maas_region_controller/tasks/update_maas.yaml
@@ -18,6 +18,7 @@
- name: Migrate MAAS database
ansible.builtin.command: "{{ 'maas' if maas_installation_type | lower == 'snap' else 'maas-region' }} migrate"
changed_when: false
+ run_once: true
- name: Refresh MAAS API
ansible.builtin.command: "{{ 'maas' if maas_installation_type | lower == 'snap' else 'maas-region' }} refresh"
This appears to fix it, but unsure if there are situations where the database migrations must be performed on each host.
This is an environment with 3 focal hosts.
Hosts file:
vars:
I'm guessing the issue is that the init/migrate is being run on all three hosts, when it should only be run once on a single host. Or at least, not in parallel to avoid race conditions.