From 38583981773181891ecf326541ee9a139fff081d Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 16 Feb 2016 11:16:25 -0500 Subject: [PATCH] Set up maintenance user for galera, root password did not work because it used symbols --- group_vars/all | 1 + roles/db/tasks/install.yml | 9 +++++---- roles/db/templates/debian.cnf.j2 | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/group_vars/all b/group_vars/all index 7795f9f..bfb5127 100644 --- a/group_vars/all +++ b/group_vars/all @@ -4,6 +4,7 @@ repository: https://github.com/jcwimer/wrestlingApp.git root_mysql_password: something heroku_jcw_password: something +debian_sys_maint_password: something proxy_stats_uri: /someplace proxy_stats_user: something proxy_stats_pass: something diff --git a/roles/db/tasks/install.yml b/roles/db/tasks/install.yml index e9e5ebf..e6b9647 100644 --- a/roles/db/tasks/install.yml +++ b/roles/db/tasks/install.yml @@ -36,14 +36,15 @@ action: shell mysql -e "CREATE USER 'heroku_jcw'@'%' IDENTIFIED BY '{{ heroku_jcw_password }}';GRANT ALL PRIVILEGES ON wrestlingtourney.* TO 'heroku_jcw'@'%'; FLUSH PRIVILEGES;" ignore_errors: yes +- name: Set maintenance password + action: shell mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '{{ debian_sys_maint_password }}' WITH GRANT OPTION; FLUSH PRIVILEGES;" + - name: set mysql root password action: shell mysql -e "UPDATE mysql.user SET password=PASSWORD('{{ root_mysql_password }}') where user='root'; FLUSH PRIVILEGES;" ignore_errors: yes -- name: Stop mysql service - service: name=mysql state=stopped - - name: Replace debian config file template: src=../roles/db/templates/debian.cnf.j2 dest=/etc/mysql/debian.cnf - +- name: Stop mysql service + service: name=mysql state=stopped diff --git a/roles/db/templates/debian.cnf.j2 b/roles/db/templates/debian.cnf.j2 index 5459b8b..d0f8085 100644 --- a/roles/db/templates/debian.cnf.j2 +++ b/roles/db/templates/debian.cnf.j2 @@ -1,13 +1,13 @@ # Automatically generated for Debian scripts. DO NOT TOUCH! [client] host = localhost -user = root -password = {{ root_mysql_password }} +user = debian-sys-maint +password = {{ debian_sys_maint_password }} socket = /var/run/mysqld/mysqld.sock [mysql_upgrade] host = localhost -user = root -password = {{ root_mysql_password }} +user = debian-sys-maint +password = {{ debian_sys_maint_password }} socket = /var/run/mysqld/mysqld.sock basedir = /usr