Skip to content

Commit

Permalink
Make formula relative to actual directory by using 'tpldir'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Kotsbak committed May 18, 2018
1 parent ec3ae80 commit 7bbf0ec
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion mysql/client.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include:
- mysql.config

{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
mysql:
Expand Down
14 changes: 7 additions & 7 deletions mysql/config.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
{% set os_family = salt['grains.get']('os_family', None) %}
Expand All @@ -18,7 +18,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 +31,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 +44,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 +57,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 +72,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
2 changes: 1 addition & 1 deletion mysql/database.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
{% set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %}
Expand Down
2 changes: 1 addition & 1 deletion mysql/dev.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:server:lookup')) %}
mysql_dev:
Expand Down
2 changes: 1 addition & 1 deletion mysql/disabled.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:server:lookup')) %}
mysql:
Expand Down
4 changes: 2 additions & 2 deletions mysql/init.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from 'mysql/database.sls' import db_states with context %}
{% from 'mysql/user.sls' import user_states with context %}
{% from tpldir ~ '/database.sls' import db_states with context %}
{% from tpldir ~ '/user.sls' import user_states with context %}
{% macro requisites(type, states) %}
{%- for state in states %}
Expand Down
2 changes: 1 addition & 1 deletion mysql/python.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:server:lookup')) %}
mysql_python:
Expand Down
2 changes: 1 addition & 1 deletion mysql/repo.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include:
- mysql.config

{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
# Completely ignore non-RHEL based systems
Expand Down
4 changes: 2 additions & 2 deletions mysql/server.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include:
- mysql.config
- mysql.python

{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:lookup')) %}
{% set os = salt['grains.get']('os', None) %}
Expand Down Expand Up @@ -163,7 +163,7 @@ mysqld:
mysql_additional_config:
file.managed:
- name: /usr/my.cnf
- source: salt://mysql/files/usr-my.cnf
- source: salt://{{ tpldir }}/files/usr-my.cnf
- create: False
- watch_in:
- service: mysqld
2 changes: 1 addition & 1 deletion mysql/user.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "mysql/defaults.yaml" import rawmap with context %}
{% from tpldir ~ "/mysql/defaults.yaml" import rawmap with context %}
{%- set mysql = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:server:lookup')) %}
{%- 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
8 changes: 4 additions & 4 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ mysql:
schema:
foo:
load: True
source: salt://mysql/files/foo.schema
source: salt://{{ tpldir }}/files/foo.schema
bar:
load: False
baz:
load: True
source: salt://mysql/files/baz.schema.tmpl
source: salt://{{ tpldir }}/files/baz.schema.tmpl
template: jinja
qux:
load: True
source: salt://mysql/files/qux.schema.tmpl
source: salt://{{ tpldir }}/files/qux.schema.tmpl
template: jinja
context:
encabulator: Turbo
girdlespring: differential
quux:
load: True
source: salt://mysql/files/qux.schema.tmpl
source: salt://{{ tpldir }}/files/qux.schema.tmpl
template: jinja
context:
encabulator: Retro
Expand Down

0 comments on commit 7bbf0ec

Please sign in to comment.