community.general.aerospike_migrations module – Check or wait for migrations between nodes
Note
This module is part of the community.general collection (version 10.7.5).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.aerospike_migrations.
Synopsis
- This can be used to check for migrations in a cluster. This makes it easy to do a rolling upgrade/update on Aerospike nodes. 
- If waiting for migrations is not desired, simply just poll until port 3000 if available or - asinfo -v statusreturns ok.
Parameters
| Parameter | Comments | 
|---|---|
| How long to try to connect before giving up (milliseconds). Default:  | |
| How many times should the cluster report “no migrations” consecutively before returning OK back to ansible? Default:  | |
| Fail if the cluster key changes if something else is changing the cluster, we may want to fail. Choices: 
 | |
| Which host do we use as seed for info connection. Default:  | |
| Do you wish to only check for migrations on the local node before returning, or do you want all nodes in the cluster to finish before returning? Choices: 
 | |
| The metric key used to determine if we have rx migrations remaining. Changeable due to backwards compatibility. Default:  | |
| The metric key used to determine if we have tx migrations remaining. Changeable due to backwards compatibility. Default:  | |
| Check will return bad until cluster size is met or until tries is exhausted. Default:  | |
| Which port to connect to Aerospike on (service port). Default:  | |
| How long to sleep between each check (seconds). Default:  | |
| When all aerospike builds in the cluster are greater than version 4.3, then the  If this option is specified on a cluster that has at least one host <4.3 then it will be ignored until the min version reaches 4.3. | |
| How many times do we poll before giving up and failing? Default:  | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| Support: full | Can run in  | |
| Support: none | Will return details on what has changed (or possibly needs changing in  | 
Examples
# check for migrations on local node
- name: Wait for migrations on local node before proceeding
  community.general.aerospike_migrations:
    host: "localhost"
    connect_timeout: 2000
    consecutive_good_checks: 5
    sleep_between_checks: 15
    tries_limit: 600
    local_only: false
# example playbook:
- name: Upgrade aerospike
  hosts: all
  become: true
  serial: 1
  tasks:
    - name: Install dependencies
      ansible.builtin.apt:
        name:
          - python
          - python-pip
          - python-setuptools
        state: latest
    - name: Setup aerospike
      ansible.builtin.pip:
        name: aerospike
# check for migrations every (sleep_between_checks)
# If at least (consecutive_good_checks) checks come back OK in a row, then return OK.
# Will exit if any exception, which can be caused by bad nodes,
# nodes not returning data, or other reasons.
# Maximum runtime before giving up in this case will be:
# Tries Limit * Sleep Between Checks * delay * retries
    - name: Wait for aerospike migrations
      community.general.aerospike_migrations:
        local_only: true
        sleep_between_checks: 1
        tries_limit: 5
        consecutive_good_checks: 3
        fail_on_cluster_change: true
        min_cluster_size: 3
        target_cluster_size: 4
      register: migrations_check
      until: migrations_check is succeeded
      changed_when: false
      delay: 60
      retries: 120
    - name: Another thing
      ansible.builtin.shell: |
        echo foo
    - name: Reboot
      ansible.builtin.reboot:
