2016-03-15 06:54:17 +00:00
|
|
|
---
|
2016-03-17 09:50:21 +00:00
|
|
|
- name: Install MySQLdb in global env
|
|
|
|
pip: name=mysql-python version=1.2.5
|
|
|
|
become: yes
|
2016-05-04 07:53:33 +00:00
|
|
|
become_user: root
|
2016-03-17 09:50:21 +00:00
|
|
|
|
2016-05-04 07:53:33 +00:00
|
|
|
- name: Set root Password for Ubuntu
|
2016-03-17 07:29:44 +00:00
|
|
|
mysql_user:
|
2016-05-04 07:53:33 +00:00
|
|
|
name: root
|
|
|
|
host: '{{ item }}'
|
|
|
|
password: '{{ mysql_root_password }}'
|
|
|
|
state: present
|
|
|
|
login_user: root
|
2016-03-15 06:54:17 +00:00
|
|
|
with_items:
|
|
|
|
- localhost
|
2016-03-17 09:50:21 +00:00
|
|
|
become: yes
|
2016-05-04 07:53:33 +00:00
|
|
|
become_user: root
|
2016-03-17 09:50:21 +00:00
|
|
|
# when you have already defined mysql root password
|
|
|
|
ignore_errors: yes
|
2016-05-04 07:53:33 +00:00
|
|
|
when: mysql_root_password is defined and ansible_distribution == 'Ubuntu'
|
2016-03-15 06:54:17 +00:00
|
|
|
|
|
|
|
- name: Add configuration
|
|
|
|
template: src={{ mysql_config_template }} dest={{ mysql_conf_dir }}/frappe.cnf owner=root mode=0644
|
2016-03-17 09:50:21 +00:00
|
|
|
become: yes
|
2016-05-04 07:53:33 +00:00
|
|
|
become_user: root
|
2016-03-17 09:50:21 +00:00
|
|
|
|
2016-04-06 10:29:52 +00:00
|
|
|
- name: restart mysql linux
|
2016-03-17 09:50:21 +00:00
|
|
|
service: name=mysql state=restarted
|
2016-03-15 06:54:17 +00:00
|
|
|
become: yes
|
2016-05-04 07:53:33 +00:00
|
|
|
become_user: root
|
2016-04-06 10:29:52 +00:00
|
|
|
when: ansible_os_family == 'RedHat' or ansible_os_family == 'Debian'
|
|
|
|
|
2016-05-04 07:53:33 +00:00
|
|
|
- name: Set root password on CentOS
|
|
|
|
command: mysqladmin -u root password '{{ mysql_root_password }}'
|
|
|
|
become: yes
|
|
|
|
become_user: root
|
|
|
|
when: mysql_root_password is defined and ansible_distribution == 'CentOS'
|
|
|
|
|
2016-04-06 10:57:24 +00:00
|
|
|
- name: add launchagents folder mac
|
|
|
|
file: path=~/Library/LaunchAgents state=directory
|
|
|
|
when: ansible_distribution == 'MacOSX'
|
|
|
|
|
2016-04-06 10:29:52 +00:00
|
|
|
- name: add mysql to mac startup
|
|
|
|
file: src=/usr/local/opt/mariadb/homebrew.mxcl.mariadb.plist path=~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist state=link force=yes
|
|
|
|
when: ansible_distribution == 'MacOSX'
|
|
|
|
|
|
|
|
- name: stop mysql mac
|
|
|
|
command: launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
|
|
|
|
when: ansible_distribution == 'MacOSX'
|
|
|
|
|
|
|
|
- name: start mysql mac
|
|
|
|
command: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
|
|
|
|
when: ansible_distribution == 'MacOSX'
|