Re-organized all files and added a Vagrantfile
This commit is contained in:
@@ -29,3 +29,7 @@
|
||||
|
||||
- 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: Stop mysql service
|
||||
service: name=mysql state=stop
|
||||
|
||||
27
roles/db/tasks/startcluster.yml
Normal file
27
roles/db/tasks/startcluster.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
# This starts the galera cluster
|
||||
|
||||
# Check if mysql is running
|
||||
- name: bootstrap by starting mysql with gcom://
|
||||
action: shell /etc/init.d/mysql start --wsrep-cluster-address="gcomm://"
|
||||
only_if: ${is_mysql_running.rc} > 0
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
6
roles/db/tasks/startmysql.yml
Normal file
6
roles/db/tasks/startmysql.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
# This starts the mysql service
|
||||
|
||||
- name: Start mysql service
|
||||
service: name=mysql state=start
|
||||
|
||||
Reference in New Issue
Block a user