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.

47 lines
978B

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- if grains.os_family == 'RedHat' %}
  4. {#- update-motd is not available in RedHat, so support only static motd #}
  5. /etc/motd:
  6. file.managed:
  7. - contents_pillar: linux:system:motd
  8. {%- else %}
  9. {%- if grains.os == 'Ubuntu' %}
  10. package_update_motd:
  11. pkg.installed:
  12. - name: update-motd
  13. - require_in:
  14. - file: /etc/update-motd.d
  15. {%- endif %}
  16. /etc/update-motd.d:
  17. file.directory:
  18. - clean: true
  19. {%- for motd in system.motd %}
  20. {%- set motd_index = loop.index %}
  21. {%- for name, value in motd.iteritems() %}
  22. motd_{{ motd_index }}_{{ name }}:
  23. file.managed:
  24. - name: /etc/update-motd.d/5{{ motd_index }}-{{ name }}
  25. - source: salt://linux/files/motd.sh
  26. - template: jinja
  27. - mode: 755
  28. - require:
  29. - file: /etc/update-motd.d
  30. - defaults:
  31. index: {{ motd_index }}
  32. motd_name: {{ name }}
  33. {%- endfor %}
  34. {%- endfor %}
  35. {%- endif %}
  36. {%- endif %}