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.

52 lines
2.1KB

  1. {%- from "linux/map.jinja" import system with context -%}
  2. # This file is managed by Salt, do not edit.
  3. {%- set module_content = system.kernel.module.get(module_name) %}
  4. {%- if module_content.get('blacklist', false) %}
  5. blacklist {{ module_name }}
  6. {%- endif %}
  7. {%- for alias, params in module_content.get('alias', {}) | dictsort %}
  8. {%- if params.get('enabled', true) %}
  9. alias {{ alias }} {{ module_name }}
  10. {%- endif %}
  11. {%- endfor %}
  12. {%- set options = [] %}
  13. {%- for option, params in module_content.get('option', {}) | dictsort %}
  14. {%- if params is mapping %}
  15. {%- if params.get('enabled', true) and params.value is defined %}
  16. {%- do options.append(option ~ '=' ~ params.value) %}
  17. {%- endif %}
  18. {%- else %}
  19. {%- do options.append(option ~ '=' ~ params) %}
  20. {%- endif %}
  21. {%- endfor %}
  22. {%- if options | length > 0 %}
  23. options {{ module_name }} {{ options | join(' ')}}
  24. {%- endif %}
  25. {%- if module_content.install is defined %}
  26. {%- if module_content.install.get('enabled', true) and module_content.install.command is defined %}
  27. install {{ module_name }} {{ module_content.install.command }}
  28. {%- endif %}
  29. {%- endif %}
  30. {%- if module_content.remove is defined %}
  31. {%- if module_content.remove.get('enabled', true) and module_content.remove.command is defined %}
  32. remove {{ module_name }} {{ module_content.remove.command }}
  33. {%- endif %}
  34. {%- endif %}
  35. {%- if module_content.softdep is defined %}
  36. {%- set pre = [] %}
  37. {%- set post = [] %}
  38. {%- for pos, params in module_content.softdep.get('pre', {}) | dictsort %}
  39. {%- if params.get('enabled', true) and params.value is defined %}
  40. {%- do pre.append(params.value) %}
  41. {%- endif %}
  42. {%- endfor %}
  43. {%- for pos, params in module_content.softdep.get('post', {}) | dictsort %}
  44. {%- if params.get('enabled', true) and params.value is defined %}
  45. {%- do post.append(params.value) %}
  46. {%- endif %}
  47. {%- endfor %}
  48. {%- if pre | length + post | length > 0 %}
  49. softdep {{ module_name }}{% if pre | length > 0 %} pre: {{ pre | join(' ') }}{% endif %}{% if post | length > 0 %} post: {{ post | join(' ') }}{% endif %}
  50. {%- endif %}
  51. {%- endif %}