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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- set pkgs_groups = {
  4. 'latest': [],
  5. 'purged': [],
  6. 'removed': [],
  7. 'installed': [],
  8. } %}
  9. {%- for name, package in system.package.items() %}
  10. {%- if package.repo is defined or package.hold is defined or package.verify is defined %}
  11. linux_extra_package_{{ name }}:
  12. {%- if package.version is defined %}
  13. {%- if package.version == 'latest' %}
  14. pkg.latest:
  15. {%- elif package.version == 'purged' %}
  16. pkg.purged:
  17. {%- elif package.version == 'removed' %}
  18. pkg.removed:
  19. {%- else %}
  20. pkg.installed:
  21. - version: {{ package.version }}
  22. {%- endif %}
  23. {%- else %}
  24. pkg.installed:
  25. {%- endif %}
  26. - name: {{ name }}
  27. {%- if package.repo is defined %}
  28. - fromrepo: {{ package.repo }}
  29. {%- endif %}
  30. {%- if package.hold is defined %}
  31. - hold: {{ package.hold }}
  32. {%- endif %}
  33. {%- if package.verify is defined %}
  34. - skip_verify: {{ "False" if package.verify else "True" }}
  35. {%- endif %}
  36. {%- else %}
  37. {%- if package.version is not defined %}
  38. {%- do pkgs_groups['installed'].append(name) %}
  39. {%- elif package.version in ('latest', 'purged', 'removed') %}
  40. {%- do pkgs_groups[package.version].append(name) %}
  41. {%- else %}
  42. {%- do pkgs_groups['installed'].append({name: package.version}) %}
  43. {%- endif %}
  44. {%- endif %}
  45. {%- endfor %}
  46. {%- for pkgs_group, pkgs in pkgs_groups.items() %}
  47. {%- if pkgs %}
  48. linux_extra_packages_{{ pkgs_group }}:
  49. pkg.{{ pkgs_group }}:
  50. - pkgs: {{ pkgs | json }}
  51. {%- endif %}
  52. {%- endfor %}
  53. {%- endif %}