Saltstack Official Linux Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

56 lines
1.1KB

  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. exist_/etc/update-motd.d:
  22. file.directory:
  23. - name: /etc/update-motd.d
  24. {%- for motd in system.motd %}
  25. {%- set motd_index = loop.index %}
  26. {%- for name, value in motd.items() %}
  27. motd_{{ motd_index }}_{{ name }}:
  28. file.managed:
  29. - name: /etc/update-motd.d/5{{ motd_index }}-{{ name }}
  30. - source: salt://linux/files/motd.sh
  31. - template: jinja
  32. - mode: 755
  33. - require_in:
  34. - file: /etc/update-motd.d
  35. - require:
  36. - file: exist_/etc/update-motd.d
  37. - defaults:
  38. index: {{ motd_index }}
  39. motd_name: {{ name }}
  40. {%- endfor %}
  41. {%- endfor %}
  42. {%- endif %}
  43. {%- endif %}