50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
---
|
|
# This installs mariadb and galera on db nodes
|
|
# https://mariadb.com/blog/devops-mariadb-part-1
|
|
# https://mariadb.com/blog/devops-mariadb-and-ansible-part-2
|
|
|
|
- name: Update apt
|
|
apt: update_cache=yes
|
|
|
|
- name: Install software properties
|
|
apt: name=software-properties-common state=present
|
|
|
|
- name: Install MariaDB repository
|
|
apt_repository: repo='deb http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/ubuntu trusty main' state=present
|
|
|
|
- name: Add repository key to the system
|
|
apt_key: keyserver=keyserver.ubuntu.com id=0xcbcb082a1bb943db
|
|
|
|
- name: Install MariaDB Server
|
|
apt: name=mariadb-server state=latest update_cache=yes
|
|
|
|
- name: Install python module
|
|
apt: name=python-mysqldb state=installed
|
|
|
|
- name: Replace config file
|
|
template: src=../roles/db/templates/my.cnf.j2 dest=/etc/mysql/my.cnf
|
|
|
|
- name: Create wrestlingtourney database
|
|
action: shell mysql -e "CREATE DATABASE wrestlingtourney;"
|
|
ignore_errors: yes
|
|
|
|
- name: Set up haproxy_check user
|
|
action: shell mysql -e "CREATE USER 'haproxy_check'@'%'; FLUSH PRIVILEGES;"
|
|
ignore_errors: yes
|
|
|
|
- name: Set up user for wrestlingtourney
|
|
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 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
|
|
|
|
|