Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

motd.sls 990B

8 vuotta sitten
8 vuotta sitten
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled and system.motd|length > 0 %}
  3. /etc/update-motd.d:
  4. file.directory:
  5. - clean: true
  6. {%- if system.motd is string %}
  7. {#- Set static motd only #}
  8. /etc/motd:
  9. file.managed:
  10. - contents_pillar: linux:system:motd
  11. {%- else %}
  12. {%- if grains.oscodename == "jessie" %}
  13. motd_fix_pam_sshd:
  14. file.replace:
  15. - name: /etc/pam.d/sshd
  16. - pattern: "/run/motd.dynamic"
  17. - repl: "/run/motd"
  18. {%- endif %}
  19. /etc/motd:
  20. file.absent
  21. {%- for motd in system.motd %}
  22. {%- set motd_index = loop.index %}
  23. {%- for name, value in motd.items() %}
  24. motd_{{ motd_index }}_{{ name }}:
  25. file.managed:
  26. - name: /etc/update-motd.d/5{{ motd_index }}-{{ name }}
  27. - source: salt://linux/files/motd.sh
  28. - template: jinja
  29. - mode: 755
  30. - require:
  31. - file: /etc/update-motd.d
  32. - defaults:
  33. index: {{ motd_index }}
  34. motd_name: {{ name }}
  35. {%- endfor %}
  36. {%- endfor %}
  37. {%- endif %}
  38. {%- endif %}