浏览代码

RHEL compatibility of motd and prompt

tags/2016.12
Filip Pytloun 8 年前
父节点
当前提交
2f70b492e0
共有 3 个文件被更改,包括 28 次插入0 次删除
  1. +15
    -0
      README.rst
  2. +11
    -0
      linux/system/motd.sls
  3. +2
    -0
      linux/system/prompt.sls

+ 15
- 0
README.rst 查看文件

@@ -293,6 +293,21 @@ day. Setting custom motd will cleanup existing ones.
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
-------------


+ 11
- 0
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 @@ motd_{{ motd_index }}_{{ name }}:

{%- endfor %}

{%- endfor %}

{%- endif %}

+ 2
- 0
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 %}

正在加载...
取消
保存