Page MenuHomeDevCentral

init.sls
No OneTemporary

init.sls

# -------------------------------------------------------------
# Salt — MOTD
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% set motd_path = salt["motd.get_path"]() %}
{% set network = salt["node.resolve_network"]() %}
motd:
file.managed:
- name: {{ motd_path }}
- source: salt://roles/core/motd/files/{{ grains["id"] }}
- template: jinja
- context:
ipv4: {{ network["ipv4_address"] }}
private_ipv4: {{ network["private_ipv4_address"] }}
ipv4_gateway: {{ network["ipv4_gateway"] }}
os_info: {{ grains["osfinger"].replace("-", " ") }}
# -------------------------------------------------------------
# Provide a `motd` command to read /etc/motd
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/usr/local/bin/motd:
file.managed:
- source: salt://roles/core/motd/files/motd.sh
- mode: 755
{% if motd_path != "/etc/motd" %}
/etc/motd:
file.symlink:
- target: {{ motd_path }}
{% endif %}
# -------------------------------------------------------------
# Scaleway instances
#
# Fixes T858.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
get_rid_of_scaleway_motd:
file.absent:
- name: /etc/update-motd.d/50-scw
# -------------------------------------------------------------
# Generate MOTD from templates
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% if grains["os_family"] == "FreeBSD" and grains["osmajorrelease"] >= 13 %}
update_motd:
cmd.run:
- name: service motd restart
- onchanges:
- file: motd
{% endif %}

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 6, 02:28 (10 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3990906
Default Alt Text
init.sls (1 KB)

Event Timeline