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

39 lines
1.2KB

  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. {% endfor %}