Setting up galera cluster, also have new strategy for internal ips
This commit is contained in:
@@ -21,14 +21,8 @@
|
||||
- name: Install python module
|
||||
apt: name=python-mysqldb state=installed
|
||||
|
||||
- name: Create replication account
|
||||
mysql_user: name=repl host="%" password={{ replication_password }} priv=*.*:"REPLICATION SLAVE" state=present
|
||||
|
||||
- name: Create readwrite user
|
||||
mysql_user: name=rwuser host="%" password={{ read_write_password }} priv=*.*:SELECT,INSERT,UPDATE,DELETE,CREATE,DROP state=present
|
||||
|
||||
- name: Modify configuration file to listen on all interfaces
|
||||
lineinfile: dest=/etc/mysql/my.cnf regexp="^bind-address" line="bind-address=0.0.0.0"
|
||||
- name: Replace config file
|
||||
template: src=my.cnf.j2 dest=/etc/mysql/my.cnf
|
||||
|
||||
- name: Stop mysql service
|
||||
service: name=mysql state=stop
|
||||
|
||||
@@ -6,22 +6,10 @@
|
||||
action: shell /etc/init.d/mysql start --wsrep-cluster-address="gcomm://"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
|
||||
- name: Create wrestlingtourney database
|
||||
action: shell mysql -e "CREATE DATABASE wrestlingtourney;"
|
||||
|
||||
- name: set mysql root password
|
||||
action: shell mysql -e "UPDATE mysql.user SET password=PASSWORD('$root_mysql_password') where user='root';"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
action: shell mysql -e "UPDATE mysql.user SET password=PASSWORD('$root_mysql_password') where user='root'; FLUSH PRIVILEGES;"
|
||||
only_if: $(is_mysql_running.rc} > 0
|
||||
|
||||
- name: create state snapshot transfer user from anywhere
|
||||
action: shell mysql -e "CREATE USER '$state_snapshot_transfer_user'@'%' IDENTIFIED BY '$state_snapshot_transfer_password';"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
|
||||
- name: create state snapshot transfer user from localhost
|
||||
action: shell mysql -e "CREATE USER '$state_snapshot_transfer_user'@'localhost' IDENTIFIED BY '$state_snapshot_transfer_password';"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
|
||||
- name: set privileges for state snapshot transfer user
|
||||
action: shell mysql -e "GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO '$state_snapshot_transfer_user'@'%';"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
|
||||
- name: set privileges for state snapshot transfer user and flush privileges
|
||||
action: shell mysql -e "GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO '$state_snapshot_transfer_user'@'localhost'; FLUSH PRIVILEGES;"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
|
||||
Reference in New Issue
Block a user