Skip to content
Merged
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
31 changes: 31 additions & 0 deletions ansible/emqx-cluster-core-rebalance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- hosts: emqx5
run_once: true
become: true
tasks:
- name: ensure cluster is healthy
ansible.builtin.shell: |
emqx ctl cluster status --json
register: cluster_status

- name: ensure stopped_nodes array is empty
assert:
that: cluster_status.stdout | from_json | json_query('stopped_nodes') == []

- name: ensure core rebalance is not running
ansible.builtin.shell: |
emqx ctl cluster core rebalance status
register: rebalance_status_init
failed_when: '"not_started" not in rebalance_status_init.stdout'

- name: start rebalance
ansible.builtin.shell: |
emqx ctl cluster core rebalance plan
emqx ctl cluster core rebalance confirm

- name: wait for rebalance to complete
ansible.builtin.shell: |
emqx ctl cluster core rebalance status
register: rebalance_status
until: rebalance_status.stdout == '{complete,[]}'
retries: 360
delay: 5
2 changes: 1 addition & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ locals {
region = try(local.spec.region, "eu-north-1")
instance_type = try(local.spec.instance_type, "t3.large")
ami_filter = try(local.spec.ami_filter, "*ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*")
ami_owner = try(local.spec.ami_owner, "amazon")
ami_owner = try(local.spec.ami_owner, "099720109477")
remote_user = try(local.spec.remote_user, "ubuntu")
use_spot_instances = try(local.spec.use_spot_instances, true)
enable_ipv6 = try(local.spec.enable_ipv6, false)
Expand Down
Loading