mirror of
https://github.com/frappe/bench.git
synced 2025-02-03 11:28:24 +00:00
commit
452ed1d4e1
@ -7,6 +7,8 @@ Installs MariaDB
|
|||||||
```
|
```
|
||||||
CentOS 6 & 7
|
CentOS 6 & 7
|
||||||
Ubuntu 14.04
|
Ubuntu 14.04
|
||||||
|
Ubuntu 16.04
|
||||||
|
Debain 9
|
||||||
```
|
```
|
||||||
|
|
||||||
## Post install
|
## Post install
|
||||||
@ -22,7 +24,7 @@ None
|
|||||||
MariaDB version:
|
MariaDB version:
|
||||||
|
|
||||||
```
|
```
|
||||||
mariadb_version: 10.0
|
mariadb_version: 10.2
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration template:
|
Configuration template:
|
||||||
@ -52,13 +54,10 @@ None
|
|||||||
```
|
```
|
||||||
- hosts: servers
|
- hosts: servers
|
||||||
roles:
|
roles:
|
||||||
- { role: pcextreme.mariadb }
|
- { role: mariadb }
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## Credits
|
||||||
|
|
||||||
MIT / BSD
|
- [Attila van der Velde](https://github.com/vdvm)
|
||||||
|
|
||||||
## Author Information
|
|
||||||
|
|
||||||
Created by [Attila van der Velde](https://github.com/vdvm)
|
|
||||||
|
@ -5,4 +5,3 @@ mysql_conf_tpl: change_me
|
|||||||
mysql_conf_file: settings.cnf
|
mysql_conf_file: settings.cnf
|
||||||
|
|
||||||
mysql_secure_installation: false
|
mysql_secure_installation: false
|
||||||
...
|
|
@ -1,4 +1,3 @@
|
|||||||
---
|
---
|
||||||
- name: restart mysql
|
- name: restart mysql
|
||||||
service: name=mysql state=restarted
|
service: name=mysql state=restarted
|
||||||
...
|
|
@ -6,5 +6,8 @@
|
|||||||
yum: name={{ item }} enablerepo=mariadb state=present
|
yum: name={{ item }} enablerepo=mariadb state=present
|
||||||
with_items:
|
with_items:
|
||||||
- MariaDB-server
|
- MariaDB-server
|
||||||
- MySQL-python # required for secure_install
|
- MariaDB-client
|
||||||
...
|
|
||||||
|
- name: Install MySQLdb Python package for secure installations.
|
||||||
|
yum: name=MySQL-python state=present
|
||||||
|
when: mysql_secure_installation and mysql_root_password is defined
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
---
|
---
|
||||||
|
- include: centos.yml
|
||||||
|
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version|int >= 6
|
||||||
|
|
||||||
- include_tasks: centos.yml
|
- include: ubuntu-trusty.yml
|
||||||
when: ansible_distribution == 'CentOS'
|
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04'
|
||||||
|
|
||||||
- include_tasks: ubuntu.yml
|
- include: ubuntu-xenial.yml
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '16.04'
|
||||||
|
|
||||||
- name: Add configuration
|
- name: Add configuration
|
||||||
template: src={{ mysql_conf_tpl }} dest={{ mysql_conf_dir[ansible_distribution] }}/{{ mysql_conf_file }} owner=root group=root mode=0644
|
template: src={{ mysql_conf_tpl }} dest={{ mysql_conf_dir[ansible_distribution] }}/{{ mysql_conf_file }} owner=root group=root mode=0644
|
||||||
|
@ -1,33 +1,22 @@
|
|||||||
---
|
---
|
||||||
# Set root password
|
|
||||||
# UPDATE mysql.user SET Password=PASSWORD('mysecret') WHERE User='root';
|
|
||||||
# FLUSH PRIVILEGES;
|
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "{{ mysql_root_password }}"
|
msg: "{{ mysql_root_password }}"
|
||||||
|
|
||||||
- name: Set root Password
|
# create root .my.cnf config file
|
||||||
mysql_user: name=root host={{ item }} password={{ mysql_root_password }} state=present
|
|
||||||
with_items:
|
|
||||||
- localhost
|
|
||||||
ignore_errors: yes
|
|
||||||
|
|
||||||
- name: Add .my.cnf
|
- name: Add .my.cnf
|
||||||
template: src=my.cnf.j2 dest=/root/.my.cnf owner=root group=root mode=0600
|
template: src=my.cnf.j2 dest=/root/.my.cnf owner=root group=root mode=0600
|
||||||
|
|
||||||
- name: display .my.cnf
|
# Set root password
|
||||||
command: cat /root/.my.cnf
|
# UPDATE mysql.user SET Password=PASSWORD('mysecret') WHERE User='root';
|
||||||
register: details
|
# FLUSH PRIVILEGES;
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ details.stdout_lines }}"
|
|
||||||
|
|
||||||
- name: Set root Password
|
- name: Set root Password
|
||||||
mysql_user: name=root host={{ item }} password={{ mysql_root_password }} state=present
|
mysql_user: login_password={{ mysql_root_password }} check_implicit_admin=yes name=root host={{ item }} password={{ mysql_root_password }} state=present
|
||||||
with_items:
|
with_items:
|
||||||
|
- localhost
|
||||||
- 127.0.0.1
|
- 127.0.0.1
|
||||||
- ::1
|
- ::1
|
||||||
when: run_travis is not defined
|
|
||||||
|
|
||||||
- name: Reload privilege tables
|
- name: Reload privilege tables
|
||||||
command: 'mysql -ne "{{ item }}"'
|
command: 'mysql -ne "{{ item }}"'
|
||||||
@ -53,7 +42,7 @@
|
|||||||
- name: Remove test database and access to it
|
- name: Remove test database and access to it
|
||||||
command: 'mysql -ne "{{ item }}"'
|
command: 'mysql -ne "{{ item }}"'
|
||||||
with_items:
|
with_items:
|
||||||
- DROP DATABASE if exists test
|
- DROP DATABASE IF EXISTS test
|
||||||
- DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'
|
- DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'
|
||||||
changed_when: False
|
changed_when: False
|
||||||
when: run_travis is not defined
|
when: run_travis is not defined
|
||||||
@ -64,20 +53,3 @@
|
|||||||
- FLUSH PRIVILEGES
|
- FLUSH PRIVILEGES
|
||||||
changed_when: False
|
changed_when: False
|
||||||
when: run_travis is not defined
|
when: run_travis is not defined
|
||||||
|
|
||||||
- name: add launchagents folder mac
|
|
||||||
file: path=~/Library/LaunchAgents state=directory
|
|
||||||
when: ansible_distribution == 'MacOSX'
|
|
||||||
|
|
||||||
- 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'
|
|
||||||
...
|
|
||||||
|
@ -6,12 +6,6 @@
|
|||||||
- name: Add repo key
|
- name: Add repo key
|
||||||
apt_key: id=1BB943DB url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xCBCB082A1BB943DB state=present
|
apt_key: id=1BB943DB url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xCBCB082A1BB943DB state=present
|
||||||
register: mariadb_key
|
register: mariadb_key
|
||||||
when: ansible_distribution_version | version_compare('16.04', 'lt')
|
|
||||||
|
|
||||||
- name: Add apt key for mariadb for Ubuntu >= 16.04
|
|
||||||
apt_key: id=C74CD1D8 url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xF1656F24C74CD1D8 state=present
|
|
||||||
register: mariadb_key
|
|
||||||
when: ansible_distribution_version | version_compare('16.04', 'ge')
|
|
||||||
|
|
||||||
- name: Update apt cache
|
- name: Update apt cache
|
||||||
apt: update_cache=yes
|
apt: update_cache=yes
|
||||||
@ -25,5 +19,9 @@
|
|||||||
apt: pkg={{ item }} state=present
|
apt: pkg={{ item }} state=present
|
||||||
with_items:
|
with_items:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- python-mysqldb # required to set the MySQL password using ansible
|
- mariadb-client
|
||||||
...
|
- libmariadbclient18
|
||||||
|
|
||||||
|
- name: Install MySQLdb Python package for secure installations.
|
||||||
|
apt: pkg=python-mysqldb state=present
|
||||||
|
when: mysql_secure_installation and mysql_root_password is defined
|
27
playbooks/roles/mariadb/tasks/ubuntu-xenial.yml
Normal file
27
playbooks/roles/mariadb/tasks/ubuntu-xenial.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
- name: Add repo file
|
||||||
|
template: src=mariadb_ubuntu.list.j2 dest=/etc/apt/sources.list.d/mariadb.list owner=root group=root mode=0644
|
||||||
|
register: mariadb_list
|
||||||
|
|
||||||
|
- name: Add repo key
|
||||||
|
apt_key: id=C74CD1D8 url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xF1656F24C74CD1D8 state=present
|
||||||
|
register: mariadb_key
|
||||||
|
|
||||||
|
- name: Update apt cache
|
||||||
|
apt: update_cache=yes
|
||||||
|
when: mariadb_list.changed == True or mariadb_key.changed == True
|
||||||
|
|
||||||
|
- name: Unattended package installation
|
||||||
|
shell: export DEBIAN_FRONTEND=noninteractive
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Install MariaDB
|
||||||
|
apt: pkg={{ item }} state=present
|
||||||
|
with_items:
|
||||||
|
- mariadb-server
|
||||||
|
- mariadb-client
|
||||||
|
- libmariadbclient18
|
||||||
|
|
||||||
|
- name: Install MySQLdb Python package for secure installations.
|
||||||
|
apt: pkg=python-mysqldb state=present
|
||||||
|
when: mysql_secure_installation and mysql_root_password is defined
|
@ -1,4 +1,4 @@
|
|||||||
# MariaDB {{ mariadb_version }} CentOS {{ ansible_distribution_major_version|int }} repository list
|
# MariaDB CentOS {{ ansible_distribution_major_version|int }} repository list
|
||||||
# http://mariadb.org/mariadb/repositories/
|
# http://mariadb.org/mariadb/repositories/
|
||||||
[mariadb]
|
[mariadb]
|
||||||
name = MariaDB
|
name = MariaDB
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# MariaDB {{ mariadb_version }} Ubuntu {{ ansible_distribution_release | title }} repository list
|
# MariaDB Ubuntu {{ ansible_distribution_release | title }} repository list
|
||||||
# http://mariadb.org/mariadb/repositories/
|
# http://mariadb.org/mariadb/repositories/
|
||||||
deb http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main
|
deb http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main
|
||||||
deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main
|
deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main
|
||||||
|
@ -3,7 +3,6 @@ mysql_conf_dir:
|
|||||||
"CentOS": /etc/my.cnf.d
|
"CentOS": /etc/my.cnf.d
|
||||||
"Ubuntu": /etc/mysql/conf.d
|
"Ubuntu": /etc/mysql/conf.d
|
||||||
"Debian": /etc/mysql/conf.d
|
"Debian": /etc/mysql/conf.d
|
||||||
"MacOSX": /usr/local/etc/my.cnf.d
|
|
||||||
mysql_conf_tpl: files/mariadb_config.cnf
|
mysql_conf_tpl: files/mariadb_config.cnf
|
||||||
mysql_secure_installation: True
|
mysql_secure_installation: True
|
||||||
...
|
...
|
Loading…
x
Reference in New Issue
Block a user