Merge "Fix conditional galera restarts"
This commit is contained in:
commit
04facf143d
@ -14,9 +14,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Check if mysql is running
|
- name: Check if mysql is running
|
||||||
shell: "pgrep -fl mysqld"
|
shell: "pgrep -fl [m]ysqld"
|
||||||
register: mysql_running
|
register: mysql_running
|
||||||
changed_when: mysql_running.rc != 0
|
changed_when: mysql_running.rc != 0
|
||||||
|
ignore_errors: True
|
||||||
tags:
|
tags:
|
||||||
- galera-bootstrap
|
- galera-bootstrap
|
||||||
|
|
||||||
@ -33,9 +34,7 @@
|
|||||||
service:
|
service:
|
||||||
name: mysql
|
name: mysql
|
||||||
state: restarted
|
state: restarted
|
||||||
when: >
|
when: wsrep_incoming_addresses|changed or mysql_running|changed
|
||||||
"not wsrep_incoming_addresses.stdout|search('{{ ansible_ssh_host }}')" or
|
|
||||||
mysql_running != 0
|
|
||||||
tags:
|
tags:
|
||||||
- galera-add-node
|
- galera-add-node
|
||||||
- galera-bootstrap
|
- galera-bootstrap
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Check if mysql is running
|
- name: Check if mysql is running
|
||||||
shell: "pgrep -fl mysqld"
|
shell: "pgrep -fl [m]ysqld"
|
||||||
register: mysql_running
|
register: mysql_running
|
||||||
changed_when: mysql_running.rc != 0
|
changed_when: mysql_running.rc != 0
|
||||||
|
ignore_errors: True
|
||||||
tags:
|
tags:
|
||||||
- galera-bootstrap
|
- galera-bootstrap
|
||||||
|
|
||||||
@ -25,7 +26,7 @@
|
|||||||
mysql -e 'show status like "wsrep_cluster_size%"\G'|awk '/Value/{print $2}'
|
mysql -e 'show status like "wsrep_cluster_size%"\G'|awk '/Value/{print $2}'
|
||||||
register: wsrep_cluster_size
|
register: wsrep_cluster_size
|
||||||
changed_when: wsrep_cluster_size.stdout|search("1")
|
changed_when: wsrep_cluster_size.stdout|search("1")
|
||||||
when: mysql_running.rc == 0
|
when: not mysql_running|changed
|
||||||
tags:
|
tags:
|
||||||
- galera-bootstrap
|
- galera-bootstrap
|
||||||
|
|
||||||
@ -36,15 +37,16 @@
|
|||||||
pattern: mysqld
|
pattern: mysqld
|
||||||
register: mysqlstopped
|
register: mysqlstopped
|
||||||
when: >
|
when: >
|
||||||
mysql_running.rc == 0 and
|
(not mysql_running|changed) and
|
||||||
(wsrep_cluster_size.stdout | search("1") or wsrep_cluster_size.stderr | search("ERROR"))
|
(wsrep_cluster_size|changed or wsrep_cluster_size.stderr | search("ERROR"))
|
||||||
tags:
|
tags:
|
||||||
- galera-bootstrap
|
- galera-bootstrap
|
||||||
|
|
||||||
- name: Check if mysql is running
|
- name: Check if mysql is running
|
||||||
shell: "pgrep -fl mysqld"
|
shell: "pgrep -fl [m]ysqld"
|
||||||
register: mysql_running
|
register: mysql_running
|
||||||
changed_when: mysql_running.rc != 0
|
changed_when: mysql_running.rc != 0
|
||||||
|
ignore_errors: True
|
||||||
tags:
|
tags:
|
||||||
- galera-bootstrap
|
- galera-bootstrap
|
||||||
|
|
||||||
@ -53,6 +55,6 @@
|
|||||||
name: mysql
|
name: mysql
|
||||||
state: restarted
|
state: restarted
|
||||||
args: --wsrep-new-cluster
|
args: --wsrep-new-cluster
|
||||||
when: wsrep_cluster_size.stdout|search("1") or mysqlstopped|changed or mysql_running != 0
|
when: wsrep_cluster_size|changed or mysqlstopped|changed or mysql_running|changed
|
||||||
tags:
|
tags:
|
||||||
- galera-bootstrap
|
- galera-bootstrap
|
||||||
|
Loading…
Reference in New Issue
Block a user