Page MenuHomeDevCentral

D962.id2456.diff
No OneTemporary

D962.id2456.diff

diff --git a/map.jinja b/map.jinja
new file mode 100644
--- /dev/null
+++ b/map.jinja
@@ -0,0 +1,14 @@
+{% set dirs = salt['grains.filter_by']({
+ 'Debian': {
+ 'etc': '/etc',
+ 'bin': '/usr/bin',
+ 'include', '/usr/include',
+ 'lib', '/usr/lib',
+ },
+ 'FreeBSD' : {
+ 'etc': '/usr/local/etc',
+ 'bin': '/usr/local/bin',
+ 'include', '/usr/local/include',
+ 'lib', '/usr/local/lib',
+ },
+}, default='Debian') %}
diff --git a/pillar/core/dirs.sls b/pillar/core/dirs.sls
deleted file mode 100644
--- a/pillar/core/dirs.sls
+++ /dev/null
@@ -1,20 +0,0 @@
-# -------------------------------------------------------------
-# Salt — Canonical directories
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Project: Nasqueron
-# Created: 2017-01-23
-# License: Trivial work, not eligible to copyright
-# -------------------------------------------------------------
-
-dirs:
- {% if grains['os_family'] == 'FreeBSD' %}
- etc: /usr/local/etc
- bin: /usr/local/bin
- include: /usr/local/include
- lib: /usr/local/lib
- {% elif grains['kernel'] == 'Linux' %}
- etc: /etc
- bin: /usr/bin
- include: /usr/include
- lib: /usr/lib
- {% endif %}
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -8,7 +8,6 @@
base:
'*':
- - core.dirs
- core.hostnames
eglide:
- users.revokedusers
diff --git a/roles/mailserver/dkim/init.sls b/roles/mailserver/dkim/init.sls
--- a/roles/mailserver/dkim/init.sls
+++ b/roles/mailserver/dkim/init.sls
@@ -6,17 +6,15 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
+{% from "map.jinja" import dirs with context %}
+
# -------------------------------------------------------------
# OpenDKIM configuration files
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
opendkim_config_files:
file.recurse:
- {% if grains['os'] == 'FreeBSD' %}
- - name: /usr/local/etc/opendkim
- {% else %}
- - name: /etc/opendkim
- {% endif %}
+ - name: {{ dirs.etc }}/opendkim
- source: salt://roles/mailserver/dkim/files/etc
- include_empty: True
- clean: False
@@ -25,11 +23,7 @@
opendkim_keys_directory:
file.directory:
- {% if grains['os'] == 'FreeBSD' %}
- - name: /usr/local/etc/opendkim/keys
- {% else %}
- - name: /etc/opendkim/keys
- {% endif %}
+ - name: {{ dirs.etc }}/opendkim/keys
- dir_mode: 711
- user: opendkim
- group: opendkim
diff --git a/roles/shellserver/database/mysql.sls b/roles/shellserver/database/mysql.sls
--- a/roles/shellserver/database/mysql.sls
+++ b/roles/shellserver/database/mysql.sls
@@ -6,6 +6,8 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
+{% from "map.jinja" import dirs with context %}
+
# -------------------------------------------------------------
# Software
# -------------------------------------------------------------
@@ -27,9 +29,6 @@
mysql_config:
file.managed:
- {% if grains['os'] == 'FreeBSD' %}
- - name: /usr/local/etc/my.cnf
- {% else %}
- - name: /etc/my.cnf
+ - name: {{ dirs.etc }}/my.cnf
{% endif %}
- source: salt://roles/shellserver/database/files/my.cnf
diff --git a/roles/shellserver/userland-software/account.sls b/roles/shellserver/userland-software/account.sls
--- a/roles/shellserver/userland-software/account.sls
+++ b/roles/shellserver/userland-software/account.sls
@@ -7,6 +7,8 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
+{% from "map.jinja" import dirs with context %}
+
# -------------------------------------------------------------
# Service account
# -------------------------------------------------------------
@@ -27,10 +29,6 @@
builder_sudo_capabilities_file:
file.managed:
- {% if grains['os'] == 'FreeBSD' %}
- - name: /usr/local/etc/sudoers.d/builder
- {% else %}
- - name: /etc/sudoers.d/builder
- {% endif %}
+ - name: {{ dirs.etc }}/sudoers.d/builder
- source: salt://roles/shellserver/userland-software/files/builder.sudoers
- template: jinja
diff --git a/roles/shellserver/userland-software/irc.sls b/roles/shellserver/userland-software/irc.sls
--- a/roles/shellserver/userland-software/irc.sls
+++ b/roles/shellserver/userland-software/irc.sls
@@ -6,6 +6,8 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
+{% from "map.jinja" import dirs with context %}
+
# -------------------------------------------------------------
# IRC clients
# -------------------------------------------------------------
@@ -56,10 +58,6 @@
oidentd_config:
file.managed:
- {% if grains['os'] == 'FreeBSD' %}
- - name: /usr/local/etc/oidentd.conf
- {% else %}
- - name: /etc/oidentd.conf
- {% endif %}
+ - name: {{ dirs.etc }}/oidentd.conf
- source: salt://roles/shellserver/userland-software/files/oidentd.conf
- mode: 644
diff --git a/roles/shellserver/web-hosting/init.sls b/roles/shellserver/web-hosting/init.sls
--- a/roles/shellserver/web-hosting/init.sls
+++ b/roles/shellserver/web-hosting/init.sls
@@ -6,17 +6,15 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
+{% from "map.jinja" import dirs with context %}
+
# -------------------------------------------------------------
# Nginx configuration files
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
nginx_config_files:
file.recurse:
- {% if grains['os'] == 'FreeBSD' %}
- - name: /usr/local/etc/nginx
- {% else %}
- - name: /etc/nginx
- {% endif %}
+ - name: {{ dirs.etc }}/nginx
- source: salt://roles/shellserver/web-hosting/files/{{ grains['id'] }}/nginx
- include_empty: True
- clean: False

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 14:36 (21 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2247651
Default Alt Text
D962.id2456.diff (5 KB)

Event Timeline