Hi All
I currently am writing automation for a Percona Galera cluster which consists of 3 nodes. I am uploading a config file with:
- name: upload my.cnf
template: src=my.cnf.j2 dest=/etc/my.cnf
when: “‘db_cluster’ in group_names”
register: db_cluster_restart
When the above config file changes I would like to restart the db cluster node by node:
-
restart mysql on 1st cluster node and wait for the restart to finish
-
restart mysql on 2nd cluster node and wait for the restart to finish
-
restart mysql on 3rd cluster node and wait for the restart to finish
My cluster group is defined this way:
[db-cluster]
db-cluster-0 ansible_ssh_host=192.168.0.1
db-cluster-1 ansible_ssh_host=192.168.0.2
db-cluster-2 ansible_ssh_host=192.168.0.3
What is the best way to achieve this kind of functionality?
BR,
Rafal.