Hugh Saunders 66d43d1bc3 Use root pass for galera init script
The galera init script uses the debian-sys-maint account to shutdown
mysql. However this password cannot be preseeded, and is randomly
generated on install. Also it is set in the database so must be updated
when replication has been achieved.

This patch implements an alternative: Use the mysql root password for
init script operations (shutdown). This password is preseedable and will
work at any state of replication.

This is no less secure than previous state as we already write root galera
credentials to /root/.my.cnf (0600) and /etc/mysql/debian.cnf is also 0600.

Related: #411
2014-10-28 10:25:07 +00:00

47 lines
1.2 KiB
YAML

---
# Copyright 2014, Rackspace US, Inc.
#
# 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: Create mysql users
mysql_user:
name: "{{ item.name }}"
host: "{{ item.host }}"
password: "{{ item.password }}"
priv: "{{ item.priv }}"
state: "{{ item.state }}"
with_items:
- name: "root"
host: "%"
password: "{{ mysql_password }}"
priv: "*.*:ALL,GRANT"
state: present
- name: "root"
host: "localhost"
password: ""
priv: "*.*:ALL"
state: absent
- name: haproxy
host: '%'
password: ""
priv: "*.*:USAGE"
state: present
- name: haproxy
host: 'localhost'
password: ""
priv: "*.*:USAGE"
state: present