openstack-ansible-galera_se.../handlers/galera_upgrade_hook.yml

40 lines
1.5 KiB
YAML

---
# Copyright 2021, City Network International AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Start mysql_safe instance
command: mariadbd-safe --skip-grant-tables --skip-networking
async: 300
poll: 0
- name: Get current root permissions
community.mysql.mysql_query:
login_unix_socket: "{{ galera_unix_socket }}"
query: select Priv from mysql.global_priv where User = 'root' and Host = 'localhost'
retries: 10
delay: 2
register: maria_root_priv
until: maria_root_priv is success
- name: Fixing root access permissions
community.mysql.mysql_query:
login_unix_socket: "{{ galera_unix_socket }}"
query: UPDATE mysql.global_priv SET Priv = %(priv)s where User = 'root' and Host = 'localhost'
named_args:
priv: "{{ maria_root_priv['query_result'][0][0]['Priv'] | replace('274877906943', '549755813887') | string }}"
when: "'549755813887' not in maria_root_priv['query_result'][0][0]['Priv']"
- name: Stop mysql_safe
command: mysql -e shutdown