Saltstack Official Linux Formula
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

99 lines
2.0KB

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {% set default_repos = {} %}
  4. {%- for name, repo in system.repo.iteritems() %}
  5. {%- if grains.os_family == 'Debian' %}
  6. {%- if repo.pin is defined %}
  7. linux_repo_{{ name }}_pin:
  8. file.managed:
  9. - name: /etc/apt/preferences.d/{{ name }}
  10. - source: salt://linux/files/preferences_repo
  11. - template: jinja
  12. - defaults:
  13. repo_name: {{ name }}
  14. {%- else %}
  15. linux_repo_{{ name }}_pin:
  16. file.absent:
  17. - name: /etc/apt/preferences.d/{{ name }}
  18. {%- endif %}
  19. {%- if repo.get('default', False) %}
  20. {%- do default_repos.update({name: repo}) %}
  21. {%- if repo.key_url %}
  22. linux_repo_{{ name }}_key:
  23. cmd.wait:
  24. - name: "curl -s {{ repo.key_url }} | apt-key add -"
  25. - watch:
  26. - file: default_repo_list
  27. {%- endif %}
  28. {%- else %}
  29. linux_repo_{{ name }}:
  30. pkgrepo.managed:
  31. - human_name: {{ name }}
  32. - name: {{ repo.source }}
  33. {%- if repo.architectures is defined %}
  34. - architectures: {{ repo.architectures }}
  35. {%- endif %}
  36. - file: /etc/apt/sources.list.d/{{ name }}.list
  37. {%- if repo.key_id is defined %}
  38. - keyid: {{ repo.key_id }}
  39. {%- endif %}
  40. {%- if repo.key_server is defined %}
  41. - keyserver: {{ repo.key_server }}
  42. {%- endif %}
  43. {%- if repo.key_url is defined %}
  44. - key_url: {{ repo.key_url }}
  45. {%- endif %}
  46. {%- endif %}
  47. {%- endif %}
  48. {%- if grains.os_family == "RedHat" %}
  49. {%- if not repo.get('default', False) %}
  50. linux_repo_{{ name }}:
  51. pkgrepo.managed:
  52. - name: {{ name }}
  53. - humanname: {{ name }}
  54. - baseurl: {{ repo.source }}
  55. - gpgcheck: {% if repo.get('gpgcheck', False) %}1{% else %}0{% endif %}
  56. {%- endif %}
  57. {%- endif %}
  58. {%- endfor %}
  59. {%- if default_repos|length > 0 and grains.os_family == 'Debian' %}
  60. default_repo_list:
  61. file.managed:
  62. - name: /etc/apt/sources.list
  63. - source: salt://linux/files/sources.list
  64. - template: jinja
  65. - user: root
  66. - group: root
  67. - mode: 0644
  68. - defaults:
  69. default_repos: {{ default_repos }}
  70. {%- endif %}
  71. {%- endif %}