Saltstack Official Apt Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

48 行
1.4KB

  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. file.managed:
  10. - mode: '0644'
  11. - user: root
  12. - group: root
  13. {% if remove_preferences %}
  14. - contents: ''
  15. - contents_newline: False
  16. {% else %}
  17. - replace: False
  18. {% endif %}
  19. {{ preferences_dir }}:
  20. file.directory:
  21. - mode: '0755'
  22. - user: root
  23. - group: root
  24. - clean: {{ clean_preferences_d }}
  25. {% for pref_file, args in preferences.items() %}
  26. {%- set p_package = args.package if args.package is defined else '*' %}
  27. {{ preferences_dir }}/{{ pref_file }}:
  28. file.managed:
  29. - mode: '0644'
  30. - user: root
  31. - group: root
  32. - contents:
  33. - "{{ 'Package: ' ~ p_package }}"
  34. - "{{ 'Pin: ' ~ args.pin }}"
  35. - "{{ 'Pin-Priority: ' ~ args.priority }}"
  36. {% if 'explanation' in args %}
  37. {% for explanation in args.explanation %}
  38. - "{{ 'Explanation: ' ~ explanation }}"
  39. {% endfor %}
  40. {% endif %}
  41. - require_in:
  42. - file: {{ preferences_dir }}
  43. {% endfor %}