Skip to content
This repository has been archived by the owner on Nov 16, 2019. It is now read-only.

Commit

Permalink
Downloads API play
Browse files Browse the repository at this point in the history
  • Loading branch information
seldo committed Aug 14, 2014
1 parent 4c7f22a commit 89edd91
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 21 deletions.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# file: mysql/defaults/main.yml

# Basic settings
mysql_root_password: 'pass'
mysql_port: 3306
mysql_bind_address: "0.0.0.0"
mysql_root_password: 'pass'
mysql_language: '/usr/share/mysql/'
mysql_datadir: '/var/lib/mysql_datadir'

Expand Down
65 changes: 47 additions & 18 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
- percona-xtrabackup
- python-mysqldb

- name: Stop percona
sudo: true
command: service mysql stop

- name: Ensure datadir exists
sudo: true
file: >
Expand All @@ -42,26 +46,55 @@
notify:
- restart percona

- name: Copy .my.cnf file into the root home folder
template: src=root-my-cnf.j2 dest=/root/.my.cnf owner=root mode=0600

- name: Initialize the datadir if it's not already populated
sudo: true
command: mysql_install_db --datadir={{ mysql_datadir }}
command: mysql_install_db --datadir={{ mysql_datadir }} --user=mysql

- name: Force datadir to be owned by mysql because mysql_install_db is shit
sudo: true
command: chown -R mysql:mysql {{ mysql_datadir }}

- name: Write custom server configuration
template: src=etc_mysql_my.cnf.j2 dest=/etc/mysql/my.cnf owner=root mode=0600

- name: Restart percona
sudo: true
command: service mysql start

#- name: Update MySQL root password
# ignore_errors: true
# command: 'mysqladmin -u root password {{ mysql_root_password }}'

#- name: Update MySQL root password
# ignore_errors: true
# mysql_user: >
# name=root
# password={{ mysql_root_password }}
# host={{ item }}
# with_items:
# - "{{ ansible_hostname }}"
# - 127.0.0.1
# - localhost

- name: Update MySQL root password
ignore_errors: true
mysql_user: name=root host={{ item }} password={{ root_password }} login_user=root login_password= check_implicit_admin=yes
- name: update mysql root password for all root accounts
mysql_user: name=root host={{ item }} password={{ mysql_root_password }}
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- localhost
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
when: ansible_hostname != 'localhost'

- name: Ensure anonymous users are not in the database
mysql_user: name='' host={{ item }} state=absent
- name: update mysql root password for all root accounts
mysql_user: name=root host={{ item }} password={{ mysql_root_password }}
with_items:
- "{{ ansible_hostname }}"
- localhost
- 127.0.0.1
- ::1
- localhost
when: ansible_hostname == 'localhost'

- name: Copy .my.cnf file into the root home folder
template: src=root-my-cnf.j2 dest=~/.my.cnf owner=root mode=0600

- name: Ensure anonymous users are not in the database
mysql_user: name='' host={{ item }} state=absent
Expand All @@ -72,7 +105,3 @@
- name: remove test database
mysql_db: name=test state=absent

- name: Write custom server configuration
template: src=etc_mysql_my.cnf.j2 dest=/etc/mysql/my.cnf owner=root mode=0600
notify:
- restart percona
2 changes: 1 addition & 1 deletion templates/etc_mysql_my.cnf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ skip-external-locking


# * Fine Tuning
key_buffer = {{ mysql_key_buffer }}
key_buffer_size = {{ mysql_key_buffer }}
max_allowed_packet = {{ mysql_max_allowed_packet }}
thread_stack = {{ mysql_thread_stack }}
thread_cache_size = {{ mysql_cache_size }}
Expand Down
2 changes: 1 addition & 1 deletion templates/root-my-cnf.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[client]
user=root
password={{ root_password }}
password={{ mysql_root_password }}

0 comments on commit 89edd91

Please sign in to comment.