-
-
Save johnccfm/8127f429c6b9c58b5615 to your computer and use it in GitHub Desktop.
This file contains 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
{% set env = pillar['environment'] %} | |
{% set cat = pillar['category'] %} | |
/etc/mysql/my.cnf: | |
file.managed: | |
- source: salt://linux/roles/db/configs/{{ cat }}/{{ env }}/my.cnf | |
- template: jinja | |
- watch_in: | |
- service: mysql | |
{% if 'db-master' in salt['pillar.get']('roles', []) %} | |
/etc/mysql/conf.d/master.cnf: | |
file.managed: | |
- source: salt://linux/roles/db/configs/{{ cat }}/{{ env }}/master.cnf | |
- template: jinja | |
- watch_in: | |
- service: mysql | |
{% endif %} | |
{% if 'db-slave' in salt['pillar.get']('roles', []) %} | |
/etc/mysql/conf.d/slave.cnf: | |
file.managed: | |
- source: salt://linux/roles/db/configs/{{ cat }}/{{ env }}/slave.cnf | |
- template: jinja | |
- watch_in: | |
- service: mysql | |
{% endif %} |
This file contains 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
mysql: | |
group.present: | |
- system: True | |
user.present: | |
- fullname: MySQL Server | |
- shell: /bin/false | |
- gid: mysql | |
- system: True | |
- home: /var/lib/mysql | |
- require: | |
- group: mysql | |
{% for dir in ['mysql', 'binlog', 'relay'] %} | |
/data/{{ dir }}: | |
file.directory: | |
- user: mysql | |
- group: mysql | |
- dir_mode: 755 | |
- file_mode: 644 | |
- recurse: | |
- user | |
- group | |
- mode | |
- require: | |
- user: mysql | |
{% endfor %} |
This file contains 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
include: | |
- .directories | |
- .config | |
- linux.shared.limits.extended_file_limits | |
mariadb: | |
pkgrepo.managed: | |
- humanname: MariaDB Repository | |
- name: deb http://lon1.mirrors.digitalocean.com/mariadb/repo/10.0/{{ grains['os']|lower }} {{ grains['oscodename'] }} main | |
- file: /etc/apt/sources.list.d/mariadb.list | |
- keyid: cbcb082a1bb943db | |
- keyserver: keyserver.ubuntu.com | |
- clean_file: true | |
- require_in: | |
- pkg: mysql-server | |
mysql-server: | |
pkg: | |
- name: mariadb-server | |
- latest | |
- require: | |
- sls: linux.roles.db.common.config | |
- sls: linux.shared.limits.extended_file_limits | |
- sls: linux.roles.db.common.directories | |
mysql-service: | |
service: | |
- name: mysql | |
- running | |
- require: | |
- pkg: mysql-server | |
# This package is required to allow | |
# salt to manage MySQL databases and users | |
python-mysqldb: | |
pkg: | |
- latest | |
require: | |
- pkg: mysql-server |
This file contains 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
percona: | |
pkgrepo.managed: | |
- humanname: Percona Repository | |
- name: deb http://repo.percona.com/apt {{ grains['oscodename'] }} main | |
- file: /etc/apt/sources.list.d/percona.list | |
- keyid: 1C4CBDCDCD2EFD2A | |
- keyserver: keys.gnupg.net | |
- clean_file: true | |
- require_in: | |
- pkg: percona-toolkit | |
- pkg: xtrabackup | |
percona-toolkit: | |
pkg: | |
- latest | |
- require: | |
- pkg: mysql-server | |
xtrabackup: | |
pkg: | |
- latest | |
- require: | |
- pkg: mysql-server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment