Merge "mariadb: Use mysql_query instead of command"
This commit is contained in:
commit
99cbe02881
@ -35,17 +35,20 @@
|
|||||||
|
|
||||||
- name: Wait for first MariaDB service to sync WSREP
|
- name: Wait for first MariaDB service to sync WSREP
|
||||||
become: true
|
become: true
|
||||||
command: >-
|
kolla_toolbox:
|
||||||
{{ kolla_container_engine }} exec {{ mariadb_service.container_name }}
|
container_engine: "{{ kolla_container_engine }}"
|
||||||
mariadb -uroot -p{{ database_password }}
|
module_name: mysql_query
|
||||||
--silent --skip-column-names
|
module_args:
|
||||||
-e 'SHOW STATUS LIKE "wsrep_local_state_comment"'
|
login_db: "mysql"
|
||||||
changed_when: false
|
login_host: "{{ api_interface_address }}"
|
||||||
|
login_port: "{{ mariadb_port }}"
|
||||||
|
login_user: "{{ database_user }}"
|
||||||
|
login_password: "{{ database_password }}"
|
||||||
|
query: 'SHOW STATUS LIKE "wsrep_local_state_comment"'
|
||||||
register: result
|
register: result
|
||||||
until: result.stdout == "wsrep_local_state_comment\tSynced"
|
until: result.query_result[0][0]['Value'] == "Synced"
|
||||||
retries: 10
|
retries: 10
|
||||||
delay: 6
|
delay: 6
|
||||||
no_log: true
|
|
||||||
listen: Bootstrap MariaDB cluster
|
listen: Bootstrap MariaDB cluster
|
||||||
|
|
||||||
- name: Ensure MariaDB is running normally on bootstrap host
|
- name: Ensure MariaDB is running normally on bootstrap host
|
||||||
|
@ -5,13 +5,18 @@
|
|||||||
|
|
||||||
- name: Wait for MariaDB service to be ready through VIP
|
- name: Wait for MariaDB service to be ready through VIP
|
||||||
become: true
|
become: true
|
||||||
command: >
|
kolla_toolbox:
|
||||||
{{ kolla_container_engine }} exec {{ mariadb_service.container_name }}
|
container_engine: "{{ kolla_container_engine }}"
|
||||||
mariadb -h {{ database_address }} -P {{ database_port }}
|
module_name: mysql_query
|
||||||
-u {{ mariadb_shard_database_user }} -p{{ database_password }} -e 'show databases;'
|
module_args:
|
||||||
|
login_db: "mysql"
|
||||||
|
login_host: "{{ api_interface_address }}"
|
||||||
|
login_port: "{{ mariadb_port }}"
|
||||||
|
login_user: "{{ database_user }}"
|
||||||
|
login_password: "{{ database_password }}"
|
||||||
|
query: "SHOW DATABASES;"
|
||||||
register: result
|
register: result
|
||||||
until: result is success
|
until: result is success
|
||||||
changed_when: False
|
changed_when: False
|
||||||
retries: 6
|
retries: 6
|
||||||
delay: 10
|
delay: 10
|
||||||
when: mariadb_shard_id == mariadb_default_database_shard_id
|
|
||||||
|
@ -44,22 +44,22 @@
|
|||||||
- block:
|
- block:
|
||||||
- name: Check MariaDB service WSREP sync status
|
- name: Check MariaDB service WSREP sync status
|
||||||
become: true
|
become: true
|
||||||
command: >-
|
kolla_toolbox:
|
||||||
{{ kolla_container_engine }} exec {{ mariadb_service.container_name }}
|
container_engine: "{{ kolla_container_engine }}"
|
||||||
mariadb -uroot -p{{ database_password }}
|
module_name: mysql_query
|
||||||
--silent --skip-column-names
|
module_args:
|
||||||
-e 'SHOW STATUS LIKE "wsrep_local_state_comment"'
|
login_db: "mysql"
|
||||||
changed_when: false
|
login_host: "{{ api_interface_address }}"
|
||||||
|
login_port: "{{ mariadb_port }}"
|
||||||
|
login_user: "{{ database_user }}"
|
||||||
|
login_password: "{{ database_password }}"
|
||||||
|
query: 'SHOW STATUS LIKE "wsrep_local_state_comment"'
|
||||||
check_mode: false
|
check_mode: false
|
||||||
register: check_mariadb_sync_status
|
register: check_mariadb_sync_status
|
||||||
no_log: true
|
|
||||||
|
|
||||||
# NOTE(yoctozepto): this is extracted separately to properly escape
|
|
||||||
# the TAB character which likes to go wrong due to interaction between
|
|
||||||
# Python/Ansible/Jinja2/YAML, the way below works
|
|
||||||
- name: Extract MariaDB service WSREP sync status
|
- name: Extract MariaDB service WSREP sync status
|
||||||
set_fact:
|
set_fact:
|
||||||
mariadb_sync_status: "{{ check_mariadb_sync_status.stdout.split('\t')[1] }}"
|
mariadb_sync_status: "{{ check_mariadb_sync_status.query_result[0][0]['Value'] }}"
|
||||||
when:
|
when:
|
||||||
- groups[mariadb_shard_group + '_port_alive_True'] is defined
|
- groups[mariadb_shard_group + '_port_alive_True'] is defined
|
||||||
- inventory_hostname in groups[mariadb_shard_group + '_port_alive_True']
|
- inventory_hostname in groups[mariadb_shard_group + '_port_alive_True']
|
||||||
|
@ -154,17 +154,20 @@
|
|||||||
|
|
||||||
- name: Wait for MariaDB to become operational
|
- name: Wait for MariaDB to become operational
|
||||||
become: true
|
become: true
|
||||||
command: >-
|
kolla_toolbox:
|
||||||
{{ kolla_container_engine }} exec {{ mariadb_service.container_name }}
|
container_engine: "{{ kolla_container_engine }}"
|
||||||
mariadb -uroot -p{{ database_password }}
|
module_name: mysql_query
|
||||||
--silent --skip-column-names
|
module_args:
|
||||||
-e 'SHOW STATUS LIKE "wsrep_evs_state"'
|
login_db: "mysql"
|
||||||
changed_when: false
|
login_host: "{{ api_interface_address }}"
|
||||||
|
login_port: "{{ mariadb_port }}"
|
||||||
|
login_user: "{{ database_user }}"
|
||||||
|
login_password: "{{ database_password }}"
|
||||||
|
query: 'SHOW STATUS LIKE "wsrep_evs_state"'
|
||||||
register: result
|
register: result
|
||||||
until: '"OPERATIONAL" in result.stdout'
|
until: result.query_result[0][0]['Value'] == "OPERATIONAL"
|
||||||
retries: 10
|
retries: 10
|
||||||
delay: 6
|
delay: 6
|
||||||
no_log: true
|
|
||||||
when:
|
when:
|
||||||
- bootstrap_host is defined
|
- bootstrap_host is defined
|
||||||
- bootstrap_host == inventory_hostname
|
- bootstrap_host == inventory_hostname
|
||||||
|
@ -30,18 +30,20 @@
|
|||||||
|
|
||||||
- name: Wait for MariaDB service to sync WSREP
|
- name: Wait for MariaDB service to sync WSREP
|
||||||
become: true
|
become: true
|
||||||
command: >-
|
kolla_toolbox:
|
||||||
{{ kolla_container_engine }} exec {{ mariadb_service.container_name }}
|
container_engine: "{{ kolla_container_engine }}"
|
||||||
mariadb -uroot -p{{ database_password }}
|
module_name: mysql_query
|
||||||
-h {{ api_interface_address }} -P {{ mariadb_port }}
|
module_args:
|
||||||
--silent --skip-column-names
|
login_db: "mysql"
|
||||||
-e 'SHOW STATUS LIKE "wsrep_local_state_comment"'
|
login_host: "{{ api_interface_address }}"
|
||||||
changed_when: false
|
login_port: "{{ mariadb_port }}"
|
||||||
|
login_user: "{{ database_user }}"
|
||||||
|
login_password: "{{ database_password }}"
|
||||||
|
query: 'SHOW STATUS LIKE "wsrep_local_state_comment"'
|
||||||
register: result
|
register: result
|
||||||
until: result.stdout == "wsrep_local_state_comment\tSynced"
|
until: result.query_result[0][0]['Value'] == "Synced"
|
||||||
retries: 10
|
retries: 10
|
||||||
delay: 6
|
delay: 6
|
||||||
no_log: true
|
|
||||||
check_mode: false
|
check_mode: false
|
||||||
when:
|
when:
|
||||||
# NOTE(yoctozepto): we don't want to wait for new nodes to fully sync
|
# NOTE(yoctozepto): we don't want to wait for new nodes to fully sync
|
||||||
|
Loading…
x
Reference in New Issue
Block a user