Browse Source

RHEL compatibility of motd and prompt

tags/2016.12
Filip Pytloun 8 years ago
parent
commit
2f70b492e0
3 changed files with 28 additions and 0 deletions
  1. +15
    -0
      README.rst
  2. +11
    -0
      linux/system/motd.sls
  3. +2
    -0
      linux/system/prompt.sls

+ 15
- 0
README.rst View File

printf "This is [company name] network.\n" printf "This is [company name] network.\n"
printf "Unauthorized access strictly prohibited.\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 Linux network
------------- -------------



+ 11
- 0
linux/system/motd.sls View File

{%- from "linux/map.jinja" import system with context %} {%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %} {%- 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: package_update_motd:
pkg.installed: pkg.installed:
- name: update-motd - name: update-motd


{%- endfor %} {%- endfor %}


{%- endfor %}

{%- endif %} {%- endif %}

+ 2
- 0
linux/system/prompt.sls View File

- source: salt://linux/files/prompt.sh - source: salt://linux/files/prompt.sh
- template: jinja - template: jinja


{%- if grains.os_family == 'Debian' %}
/etc/bash.bashrc: /etc/bash.bashrc:
file.replace: file.replace:
- pattern: ".*PS1=.*" - pattern: ".*PS1=.*"
file.replace: file.replace:
- pattern: ".*PS1=.*" - pattern: ".*PS1=.*"
- repl: ": # Prompt is set by /etc/profile.d/prompt.sh" - repl: ": # Prompt is set by /etc/profile.d/prompt.sh"
{%- endif %}


{%- endif %} {%- endif %}

Loading…
Cancel
Save