Saltstack Official Apt Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

repositories.sls 2.4KB

8 lat temu
8 lat temu
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. {% set keyring_package = apt.get('keyring_package', apt_map.default_keyring_package) %}
  9. {{ keyring_package }}:
  10. pkg.installed
  11. /etc/apt/sources.list:
  12. file.managed:
  13. - mode: '0644'
  14. - user: root
  15. - group: root
  16. {% if remove_sources_list %}
  17. - contents: ''
  18. - contents_newline: False
  19. {% endif %}
  20. {{ sources_list_dir }}:
  21. file.directory:
  22. - mode: '0755'
  23. - user: root
  24. - group: root
  25. - clean: {{ clean_sources_list_d }}
  26. {% for repo, args in repositories.iteritems() %}
  27. {% set r_opts = '' %}
  28. {%- set r_arch = 'arch=' ~ args.arch|join(',') if args.arch is defined else '' %}
  29. {% if args.opts is defined %}
  30. {% if args.opts is string %}
  31. {% set r_opts = args.opts %}
  32. {% else %}
  33. {% set r_opts_list = [] %}
  34. {%- for k, v in args.opts.items() %}
  35. {% do r_opts_list.append(k ~ '=' ~ v) %}
  36. {%- endfor %}
  37. {% set r_opts = r_opts_list|join(' ') %}
  38. {% endif %}
  39. {% endif %}
  40. {% if r_arch != '' or r_opts != '' %}
  41. {% set r_options = '[' ~ r_arch ~ ' ' ~ r_opts ~ ' ]' %}
  42. {% else %}
  43. {% set r_options = '' %}
  44. {% endif %}
  45. {%- set r_url = args.url or default_url %}
  46. {%- set r_distro = args.distro or 'stable' %}
  47. {%- set r_comps = args.comps|default(['main'])|join(' ') %}
  48. {%- set r_keyserver = args.keyserver if args.keyserver is defined else apt_map.default_keyserver %}
  49. {%- for type in args.type|d(['binary']) %}
  50. {%- set r_type = 'deb-src' if type == 'source' else 'deb' %}
  51. {{ r_type }} {{ repo }}:
  52. pkgrepo.managed:
  53. - name: {{ r_type }} {{ r_options }} {{ r_url }} {{ r_distro }} {{ r_comps }}
  54. - file: {{ sources_list_dir }}/{{ repo }}-{{ type }}.list
  55. {# You can use either keyid+keyserver or key_url. If both are provided
  56. the latter will be used. #}
  57. {% if args.key_url is defined %}
  58. - key_url: {{ args.key_url }}
  59. {% elif args.keyid is defined %}
  60. - keyid: {{ args.keyid }}
  61. - keyserver: {{ r_keyserver }}
  62. {% endif %}
  63. - clean_file: true
  64. {%- endfor %}
  65. {% endfor %}