cleanup: refactor into galera_mariadb_service_name

We had two variable names which were duplicated for the service
name, this converges them all to "mariadb" which uses the actual
systemd unit instead of the init.d compatiblity layer.

Change-Id: I5805fb11a5118c4011701377cd30b2511edca505
This commit is contained in:
Mohammed Naser 2019-07-12 12:41:41 -04:00
parent ea1f268832
commit 7c7ade4fc9
9 changed files with 10 additions and 20 deletions

View File

@ -37,6 +37,7 @@ galera_cluster_name: openstack_galera_cluster
# if these are used they should be set within the
# distro specific variable files found in vars/
galera_debconf_items: []
galera_mariadb_service_name: mariadb
galera_mariadb_server_package: "{{ _galera_mariadb_server_package }}"
# The major version used to select the repo URL path

View File

@ -16,7 +16,7 @@
- name: Reload the systemd daemon
systemd:
daemon_reload: yes
name: "{{ mysql_service_name }}"
name: "{{ galera_mariadb_service_name }}"
enabled: "yes"
- name: Check node status
@ -70,7 +70,7 @@
- name: Restart mysql (All)
service:
name: "{{ mysql_service_name }}"
name: "{{ galera_mariadb_service_name }}"
state: "{{ (not hostvars[item]['galera_cluster_ready'] | bool) | ternary('started', 'restarted') }}"
environment:
MYSQLD_STARTUP_TIMEOUT: 180

View File

@ -47,16 +47,16 @@ EOF
trap cleanup EXIT INT TERM
EXIT_CODE=0
if ! systemctl status {{ mysql_service_name }}> /dev/null; then
if ! systemctl status {{ galera_mariadb_service_name }}> /dev/null; then
systemctl set-environment _WSREP_NEW_CLUSTER='--wsrep-new-cluster'
if grep -rniq -e suse -e opensuse /etc/os-release; then
bootstrap_opts
fi
if systemctl start {{ mysql_service_name }}; then
if systemctl start {{ galera_mariadb_service_name }}; then
EXIT_CODE=3
else
echo "Cluster bootstrap failed."
systemctl status {{ mysql_service_name }}
systemctl status {{ galera_mariadb_service_name }}
exit 99
fi
fi

View File

@ -17,12 +17,12 @@ set -ev
STOP_MYSQL=false
if ! systemctl status {{ mysql_service_name }}; then
if ! systemctl status {{ galera_mariadb_service_name }}; then
STOP_MYSQL=true
systemctl set-environment MYSQLD_OPTS="--bind-address=127.0.0.1"
systemctl start {{ mysql_service_name }}
systemctl start {{ galera_mariadb_service_name }}
sleep 10
systemctl status {{ mysql_service_name }}
systemctl status {{ galera_mariadb_service_name }}
fi
if mysqladmin --no-defaults --port=3306 --socket=/var/run/mysqld/mysqld.sock --host=127.0.0.1 --user=root password "{{ galera_root_password }}"; then
@ -38,7 +38,7 @@ if mysqladmin --no-defaults --port=3306 --socket=/var/run/mysqld/mysqld.sock --h
fi
if [ "${STOP_MYSQL}" = true ]; then
systemctl stop {{ mysql_service_name }}
systemctl stop {{ galera_mariadb_service_name }}
fi
# Create a marker file to ensure this script is not run again

View File

@ -64,8 +64,6 @@ galera_server_upgrade_packages_remove:
- mariadb-server
- mysql-common
galera_mariadb_service_name: "mariadb"
galera_debconf_items:
- question: "mysql-server/root_password"
name: "{{ galera_mariadb_server_package }}"

View File

@ -45,8 +45,4 @@ galera_server_mariadb_distro_packages:
# The packages to uninstall during an upgrade from a previous version
galera_server_upgrade_packages_remove:
galera_mariadb_service_name: "mariadb"
galera_wsrep_provider: "/usr/lib64/galera/libgalera_smm.so"
mysql_service_name: mariadb

View File

@ -1 +0,0 @@
mysql_service_name: mysql

View File

@ -60,8 +60,6 @@ galera_server_upgrade_packages_remove:
- MariaDB-Galera-server
- MariaDB-server
galera_mariadb_service_name: "mariadb"
_galera_repo_url: "http://{{ galera_repo_host }}/MariaDB/mariadb-{{ galera_client_major_version }}.{{ galera_client_minor_version }}/yum/{{ ansible_distribution | lower }}{{ ansible_distribution_major_version }}-amd64/"
_galera_repo:
name: MariaDB

View File

@ -58,8 +58,6 @@ galera_server_upgrade_packages_remove:
- MariaDB-Galera-server
- MariaDB-server
galera_mariadb_service_name: "mariadb"
_galera_opensuse_dir: "{{ ansible_distribution_major_version }}"
_galera_repo_url: "http://{{ galera_repo_host }}/MariaDB/mariadb-{{ galera_major_version }}.{{ galera_minor_version }}/yum/opensuse{{ _galera_opensuse_dir }}-amd64"
_galera_repo: