Saltstack Official UFW 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.

50 lines
1.4KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {#- Get the `tplroot` from `tpldir` #}
  4. {%- set tplroot = tpldir.split('/')[0] %}
  5. {%- set sls_package_install = tplroot ~ '.package.install' %}
  6. {%- from tplroot ~ "/map.jinja" import ufw with context %}
  7. {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
  8. include:
  9. - {{ sls_package_install }}
  10. ufw-default-file-file-managed:
  11. file.managed:
  12. - name: {{ ufw.default_file }}
  13. - user: root
  14. - group: root
  15. - template: jinja
  16. - source: {{ files_switch(['ufw.default.tmpl', 'ufw.default.tmpl.jinja'],
  17. lookup='ufw-default-file-file-managed'
  18. )
  19. }}
  20. - require:
  21. - sls: {{ sls_package_install }}
  22. - context:
  23. ufw_settings: {{ ufw.settings | json }}
  24. ufw-sysctl-file-file-managed:
  25. file.managed:
  26. - name: {{ ufw.sysctl_file }}
  27. - user: root
  28. - group: root
  29. - template: jinja
  30. - source: {{ files_switch(['ufw.sysctl.tmpl', 'ufw.sysctl.tmpl.jinja'],
  31. lookup='ufw-sysctl-file-file-managed'
  32. )
  33. }}
  34. - require:
  35. - sls: {{ sls_package_install }}
  36. - context:
  37. ufw_sysctl: {{ ufw.sysctl | json }}
  38. /etc/ufw/applications.d:
  39. file.recurse:
  40. - user: root
  41. - group: root
  42. - file_mode: 644
  43. - clean: False
  44. - source: salt://ufw/files/applications.d