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.

57 lines
1.8KB

  1. {% from "apt/map.jinja" import apt as apt_map with context %}
  2. {% set apt = pillar.get('apt', {}) %}
  3. {% set remove_sources_list = apt.get('remove_sources_list', apt_map.remove_sources_list) %}
  4. {% set clean_sources_list_d = apt.get('clean_sources_list_d', apt_map.clean_sources_list_d) %}
  5. {% set sources_list_dir = apt.get('sources_list_dir', apt_map.sources_list_dir) %}
  6. {% set repositories = apt.get('repositories', apt_map.repositories) %}
  7. {% set default_url = apt.get('default_url', apt_map.default_url) %}
  8. debian-archive-keyring:
  9. pkg.installed
  10. /etc/apt/sources.list:
  11. {% if remove_sources_list %}
  12. file.absent
  13. {% else %}
  14. file.managed:
  15. - mode: 0644
  16. - user: root
  17. - group: root
  18. {% endif %}
  19. {{ sources_list_dir }}:
  20. file.directory:
  21. - mode: 0755
  22. - user: root
  23. - group: root
  24. - clean: {{ clean_sources_list_d }}
  25. {% for repo, args in repositories.iteritems() %}
  26. {%- set r_arch = '[arch=' ~ args.arch|join(',') ~ ']' if args.arch is defined else '' %}
  27. {%- set r_url = args.url or default_url %}
  28. {%- set r_distro = args.distro or 'stable' %}
  29. {%- set r_comps = args.comps|default(['main'])|join(' ') %}
  30. {%- if "binary" in args.type|d(["binary"]) %}
  31. {{ repo }}:
  32. pkgrepo.managed:
  33. - name: deb {{ r_arch }} {{ r_url }} {{ r_distro }} {{ r_comps }}
  34. - file: {{ sources_list_dir }}/{{ repo }}.list
  35. {% if args.key_url is defined %}
  36. - key_url: {{ args.key_url }}
  37. {% endif %}
  38. - clean_file: true
  39. {% endif %}
  40. {%- if "source" in args.type|d(["binary"]) %}
  41. {{ repo }}:
  42. pkgrepo.managed:
  43. - name: deb-src {{ r_arch }} {{ r_url }} {{ r_distro }} {{ r_comps }}
  44. - file: {{ sources_list_dir }}/{{ repo }}.list
  45. {% if args.key_url is defined %}
  46. - key_url: {{ args.key_url }}
  47. {% endif %}
  48. - clean_file: true
  49. {% endif %}
  50. {% endfor %}