``/etc/skel/.bashrc``). This formula will do this automatically, but will not | ``/etc/skel/.bashrc``). This formula will do this automatically, but will not | ||||
touch existing user's ``~/.bashrc`` files except root. | 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 | Linux network | ||||
------------- | ------------- | ||||
{%- 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 -%} |
'group': {}, | 'group': {}, | ||||
'job': {}, | 'job': {}, | ||||
'limit': {}, | 'limit': {}, | ||||
'motd': {}, | |||||
'repo': {}, | 'repo': {}, | ||||
'package': {}, | 'package': {}, | ||||
'selinux': 'permissive', | 'selinux': 'permissive', | ||||
'group': {}, | 'group': {}, | ||||
'job': {}, | 'job': {}, | ||||
'limit': {}, | 'limit': {}, | ||||
'motd': {}, | |||||
'repo': {}, | 'repo': {}, | ||||
'package': {}, | 'package': {}, | ||||
'selinux': 'permissive', | 'selinux': 'permissive', | ||||
'group': {}, | 'group': {}, | ||||
'job': {}, | 'job': {}, | ||||
'limit': {}, | 'limit': {}, | ||||
'motd': {}, | |||||
'repo': {}, | 'repo': {}, | ||||
'package': {}, | 'package': {}, | ||||
'selinux': 'permissive', | 'selinux': 'permissive', |
{%- if system.limit|length > 0 %} | {%- if system.limit|length > 0 %} | ||||
- linux.system.limit | - linux.system.limit | ||||
{%- endif %} | {%- endif %} | ||||
{%- if system.motd|length > 0 %} | |||||
- linux.system.motd | |||||
{%- endif %} |
{%- 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 %} |