Created
October 24, 2013 07:09
-
-
Save joelrebel/7132598 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#A mysql host/group should define either the 'percona_mysql' or 'vanilla_mysql' to true, | |
#this tells the play which mysql variant should be installed. | |
--- | |
#apt_expects the exact url to the key, the url can be found by searching for the id at http://keyserver.ubuntu.com/ | |
- name: add_percona_aptkeys | |
action: apt_key data="{{ lookup('file', '../files/percona.gpg') }}" ## id=1C4CBDCDCD2EFD2A url="http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1C4CBDCDCD2EFD2A" state=present ## apt_key module needs fixing to look up keys. | |
when: percona_mysql is defined | |
tags: | |
- mysql | |
- add_percona_aptkeys | |
- name: add_percona_repo_src | |
action: apt_repository repo='deb-src http://repo.percona.com/apt precise main' state=present | |
when: percona_mysql is defined | |
tags: | |
- mysql | |
- add_percona_repo_src | |
- name: add_percona_repo_src | |
action: apt_repository repo='deb http://repo.percona.com/apt precise main' state=present update_cache=yes | |
when: percona_mysql is defined | |
tags: | |
- mysql | |
- add_percona_repo_src | |
- name: install_percona_pkgs | |
action: apt pkg={{ item }} state=present | |
with_items: | |
- percona-server-server-5.5 | |
- percona-server-client-5.5 | |
when: percona_mysql is defined | |
tags: | |
- mysql | |
- install_percona_pkgs | |
- name: install_vanilla_mysql | |
action: apt pkg={{ item }} state=present | |
with_items: | |
- mysql-server | |
- mysql-client | |
when: vanilla_mysql is defined | |
tags: | |
- mysql | |
- install_vanilla_mysql | |
- name: setup_mysql_root_user | |
action: mysql_user name=root password="{{ LOOKUP('password', ~/ansible/mysql_pw length=6) }}" | |
tags: | |
- mysql | |
- setup_mysql_root_user | |
# 0) installs dependency - python-mysqldb. | |
# 1) installs mysql package | |
# 2) sets up a root password | |
# 3) creates a /root/.my.cnf file with creds | |
# 4) iterates through users, sets respective passwords, permissions based on a config file in .private/mysql.$hostname | |
# | |
# - dbusers | |
# - user1 | |
# - password | |
# - permissions | |
# - user2 | |
# - password | |
# - permissions | |
# | |
# 5) accepts dbnames to create via a role/var file | |
# - if stat .private/mysql.$hostname | |
# - run through .private/mysql.$hostname | |
# 6) adds a mysql user for monitoring - should have permissions only to do a check process list. | |
# 7) check_mk check to ping mysql and list number of running processes - set threshold to x | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment