Saltstack Official Apt Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

55 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. {%- set r_keyserver = args.keyserver if args.keyserver is defined else apt_map.default_keyserver %}
  31. {%- for type in args.type|d(['binary']) %}
  32. {%- set r_type = 'deb-src' if type == 'source' else 'deb' %}
  33. {{ repo }}{{ type }}:
  34. pkgrepo.managed:
  35. - name: {{ r_type }} {{ r_arch }} {{ r_url }} {{ r_distro }} {{ r_comps }}
  36. - file: {{ sources_list_dir }}/{{ repo }}-{{ type }}.list
  37. {# You can use either keyid+keyserver or key_url. If both are provided
  38. the latter will be used. #}
  39. {% if args.key_url is defined %}
  40. - key_url: {{ args.key_url }}
  41. {% elif args.keyid is defined %}
  42. - keyid: {{ args.keyid }}
  43. - keyserver: {{ r_keyserver }}
  44. {% endif %}
  45. - clean_file: true
  46. {%- endfor %}
  47. {% endfor %}