Saltstack Official Apt Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

preferences.sls 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {% from "apt/map.jinja" import apt as apt_map with context %}
  2. {% set apt = pillar.get('apt', {}) %}
  3. {% set remove_preferences = apt.get('remove_preferences', apt_map.remove_preferences) %}
  4. {% set clean_preferences_d = apt.get('clean_preferences_d', apt_map.clean_preferences_d) %}
  5. {% set preferences_dir = apt.get('preferences_dir', apt_map.preferences_dir) %}
  6. {% set preferences = apt.get('preferences', apt_map.preferences) %}
  7. {% set default_url = apt.get('default_url', apt_map.default_url) %}
  8. /etc/apt/preferences:
  9. {% if remove_preferences %}
  10. file.absent
  11. {% else %}
  12. file.managed:
  13. - mode: '0644'
  14. - user: root
  15. - group: root
  16. {% endif %}
  17. {{ preferences_dir }}:
  18. file.directory:
  19. - mode: '0755'
  20. - user: root
  21. - group: root
  22. - clean: {{ clean_preferences_d }}
  23. {% for pref_file, args in preferences.iteritems() %}
  24. {%- set p_package = args.package if args.package is defined else '*' %}
  25. {{ preferences_dir }}/{{ pref_file }}:
  26. file.managed:
  27. - mode: '0644'
  28. - user: root
  29. - group: root
  30. - contents:
  31. - "{{ 'Package: ' ~ p_package }}"
  32. - "{{ 'Pin: ' ~ args.pin }}"
  33. - "{{ 'Pin-Priority: ' ~ args.priority }}"
  34. {% if 'explanation' in args %}
  35. {% for explanation in args.explanation %}
  36. - "{{ 'Explanation: ' ~ explanation }}"
  37. {% endfor %}
  38. {% endif %}
  39. {% endfor %}