RHEL compatibility of motd and prompt
diff --git a/README.rst b/README.rst
index 9d1ae82..f3819ed 100644
--- a/README.rst
+++ b/README.rst
@@ -293,6 +293,21 @@
printf "This is [company name] network.\n"
printf "Unauthorized access strictly prohibited.\n"
+RHEL / CentOS
+~~~~~~~~~~~~~
+
+Unfortunately ``update-motd`` is currently not available for RHEL so there's
+no native support for dynamic motd.
+You can still set static one, only pillar structure differs:
+
+.. code-block:: yaml
+
+ linux:
+ system:
+ motd: |
+ This is [company name] network.
+ Unauthorized access strictly prohibited.
+
Linux network
-------------
diff --git a/linux/system/motd.sls b/linux/system/motd.sls
index e45a9f3..e376854 100644
--- a/linux/system/motd.sls
+++ b/linux/system/motd.sls
@@ -1,6 +1,15 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}
+{%- if grains.os_family == 'RedHat' %}
+
+{#- update-motd is not available in RedHat, so support only static motd #}
+/etc/motd:
+ file.managed:
+ - contents_pillar: pillar:linux:system:motd
+
+{%- else %}
+
package_update_motd:
pkg.installed:
- name: update-motd
@@ -30,4 +39,6 @@
{%- endfor %}
+{%- endfor %}
+
{%- endif %}
diff --git a/linux/system/prompt.sls b/linux/system/prompt.sls
index b191d14..3b417f6 100644
--- a/linux/system/prompt.sls
+++ b/linux/system/prompt.sls
@@ -6,6 +6,7 @@
- source: salt://linux/files/prompt.sh
- template: jinja
+{%- if grains.os_family == 'Debian' %}
/etc/bash.bashrc:
file.replace:
- pattern: ".*PS1=.*"
@@ -20,5 +21,6 @@
file.replace:
- pattern: ".*PS1=.*"
- repl: ": # Prompt is set by /etc/profile.d/prompt.sh"
+{%- endif %}
{%- endif %}