Browse Source

add motd state

Karsten Böddeker 4 years ago
parent
commit
6605a8fd50
2 changed files with 20 additions and 0 deletions
  1. 19 0
      motd/init.sls
  2. 1 0
      top.sls

+ 19 - 0
motd/init.sls

@@ -0,0 +1,19 @@
+#
+# motd
+#
+
+{% set name = grains.id.split('.') %}
+motd:
+  pkg.installed:
+    - pkgs:
+      - figlet
+
+  cmd.run:
+    - name: echo > /etc/motd.ffho ; figlet {{name[0]}} >> /etc/motd.ffho; sed -i -e 's/^\(.*\)/     \1/' /etc/motd.ffho ; sed -i -e '$s/\(.*\)/\1.{{name[1:]|join('.')}}/' /etc/motd.ffho ; echo >> /etc/motd.ffho
+    - creates: /etc/motd.ffho
+
+  file.symlink:
+    - name: /etc/motd
+    - target: /etc/motd.ffho
+    - force: True
+    - backupname: /etc/motd.old

+ 1 - 0
top.sls

@@ -10,6 +10,7 @@ base:
     - kernel
     - locales
     - mosh
+    - motd
     - network
     - ntp
     - postfix