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.

9 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. {%- if grains.oscodename == "jessie" %}
  20. motd_fix_pam_sshd:
  21. file.replace:
  22. - name: /etc/pam.d/sshd
  23. - pattern: "/run/motd.dynamic"
  24. - repl: "/run/motd"
  25. {%- endif %}
  26. {%- for motd in system.motd %}
  27. {%- set motd_index = loop.index %}
  28. {%- for name, value in motd.iteritems() %}
  29. motd_{{ motd_index }}_{{ name }}:
  30. file.managed:
  31. - name: /etc/update-motd.d/5{{ motd_index }}-{{ name }}
  32. - source: salt://linux/files/motd.sh
  33. - template: jinja
  34. - mode: 755
  35. - require:
  36. - file: /etc/update-motd.d
  37. - defaults:
  38. index: {{ motd_index }}
  39. motd_name: {{ name }}
  40. {%- endfor %}
  41. {%- endfor %}
  42. {%- endif %}
  43. {%- endif %}