Skip to content

Commit

Permalink
Introduce standardized mapping files
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Jun 18, 2018
1 parent ec3ae80 commit 704ee89
Show file tree
Hide file tree
Showing 19 changed files with 441 additions and 475 deletions.
5 changes: 2 additions & 3 deletions mysql/client.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
include:
- mysql.config

{% from "mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
{% from tpldir ~ "/map.jinja" import mysql with context %}
mysql:
pkg.installed:
- name: {{ mysql.client }}
- name: {{ mysql.clientpkg }}
15 changes: 7 additions & 8 deletions mysql/config.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
{% from tpldir ~ "/map.jinja" import mysql with context %}
{% set os_family = salt['grains.get']('os_family', None) %}
{% if "config_directory" in mysql %}
Expand All @@ -18,7 +17,7 @@ mysql_server_config:
file.managed:
- name: {{ mysql.config_directory + mysql.server_config.file }}
- template: jinja
- source: salt://mysql/files/server.cnf
- source: salt://{{ tpldir }}/files/server.cnf
{% if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
- group: root
Expand All @@ -31,7 +30,7 @@ mysql_galera_config:
file.managed:
- name: {{ mysql.config_directory + mysql.galera_config.file }}
- template: jinja
- source: salt://mysql/files/galera.cnf
- source: salt://{{ tpldir }}/files/galera.cnf
{% if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
- group: root
Expand All @@ -44,7 +43,7 @@ mysql_library_config:
file.managed:
- name: {{ mysql.config_directory + mysql.library_config.file }}
- template: jinja
- source: salt://mysql/files/client.cnf
- source: salt://{{ tpldir }}/files/client.cnf
{% if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
- group: root
Expand All @@ -57,7 +56,7 @@ mysql_clients_config:
file.managed:
- name: {{ mysql.config_directory + mysql.clients_config.file }}
- template: jinja
- source: salt://mysql/files/mysql-clients.cnf
- source: salt://{{ tpldir }}/files/mysql-clients.cnf
{% if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
- group: root
Expand All @@ -72,9 +71,9 @@ mysql_config:
- name: {{ mysql.config.file }}
- template: jinja
{% if "config_directory" in mysql %}
- source: salt://mysql/files/my-include.cnf
- source: salt://{{ tpldir }}/files/my-include.cnf
{% else %}
- source: salt://mysql/files/my.cnf
- source: salt://{{ tpldir }}/files/my.cnf
{% endif %}
{% if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
Expand Down
3 changes: 1 addition & 2 deletions mysql/database.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
{% from tpldir ~ "/map.jinja" import mysql with context %}
{% set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %}
{% set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %}
Expand Down
Loading

0 comments on commit 704ee89

Please sign in to comment.