@@ -236,6 +236,32 @@ PS1 in ``/etc/bash.bashrc`` and ``~/.bashrc`` (which comes from | |||
``/etc/skel/.bashrc``). This formula will do this automatically, but will not | |||
touch existing user's ``~/.bashrc`` files except root. | |||
Message of the day | |||
~~~~~~~~~~~~~~~~~~ | |||
``pam_motd`` from package ``update-motd`` is used for dynamic messages of the | |||
day. Setting custom motd will cleanup existing ones. | |||
.. code-block:: yaml | |||
linux: | |||
system: | |||
motd: | |||
- release: | | |||
#!/bin/sh | |||
[ -r /etc/lsb-release ] && . /etc/lsb-release | |||
if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then | |||
# Fall back to using the very slow lsb_release utility | |||
DISTRIB_DESCRIPTION=$(lsb_release -s -d) | |||
fi | |||
printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" | |||
- warning: | | |||
#!/bin/sh | |||
printf "This is [company name] network.\n" | |||
printf "Unauthorized access strictly prohibited.\n" | |||
Linux network | |||
------------- | |||
@@ -0,0 +1,8 @@ | |||
{%- from "linux/map.jinja" import system with context -%} | |||
{%- for motd in system.motd -%} | |||
{%- if loop.index == index -%} | |||
{%- for name, value in motd.iteritems() -%} | |||
{%- if name == motd_name -%}{{ value }}{%- endif %} | |||
{%- endfor -%} | |||
{%- endif -%} | |||
{%- endfor -%} |
@@ -6,6 +6,7 @@ | |||
'group': {}, | |||
'job': {}, | |||
'limit': {}, | |||
'motd': {}, | |||
'repo': {}, | |||
'package': {}, | |||
'selinux': 'permissive', | |||
@@ -18,6 +19,7 @@ | |||
'group': {}, | |||
'job': {}, | |||
'limit': {}, | |||
'motd': {}, | |||
'repo': {}, | |||
'package': {}, | |||
'selinux': 'permissive', | |||
@@ -30,6 +32,7 @@ | |||
'group': {}, | |||
'job': {}, | |||
'limit': {}, | |||
'motd': {}, | |||
'repo': {}, | |||
'package': {}, | |||
'selinux': 'permissive', |
@@ -48,3 +48,6 @@ include: | |||
{%- if system.limit|length > 0 %} | |||
- linux.system.limit | |||
{%- endif %} | |||
{%- if system.motd|length > 0 %} | |||
- linux.system.motd | |||
{%- endif %} |
@@ -0,0 +1,33 @@ | |||
{%- from "linux/map.jinja" import system with context %} | |||
{%- if system.enabled %} | |||
package_update_motd: | |||
pkg.installed: | |||
- name: update-motd | |||
/etc/update-motd.d: | |||
file.directory: | |||
- clean: true | |||
- require: | |||
- pkg: package_update_motd | |||
{%- for motd in system.motd %} | |||
{%- set motd_index = loop.index %} | |||
{%- for name, value in motd.iteritems() %} | |||
motd_{{ motd_index }}_{{ name }}: | |||
file.managed: | |||
- name: /etc/update-motd.d/5{{ motd_index }}-{{ name }} | |||
- source: salt://linux/files/motd.sh | |||
- template: jinja | |||
- mode: 755 | |||
- require: | |||
- file: /etc/update-motd.d | |||
- defaults: | |||
index: {{ motd_index }} | |||
motd_name: {{ name }} | |||
{%- endfor %} | |||
{%- endfor %} | |||
{%- endif %} |