Saltstack Official Linux Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

106 lines
2.2KB

  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: {{ repo.get('humanname', name) }}
  54. {%- if repo.mirrorlist is defined %}
  55. - mirrorlist: {{ repo.mirrorlist }}
  56. {%- else %}
  57. - baseurl: {{ repo.source }}
  58. {%- endif %}
  59. - gpgcheck: {% if repo.get('gpgcheck', False) %}1{% else %}0{% endif %}
  60. {%- if repo.gpgkey is defined %}
  61. - gpgkey: {{ repo.gpgkey }}
  62. {%- endif %}
  63. {%- endif %}
  64. {%- endif %}
  65. {%- endfor %}
  66. {%- if default_repos|length > 0 and grains.os_family == 'Debian' %}
  67. default_repo_list:
  68. file.managed:
  69. - name: /etc/apt/sources.list
  70. - source: salt://linux/files/sources.list
  71. - template: jinja
  72. - user: root
  73. - group: root
  74. - mode: 0644
  75. - defaults:
  76. default_repos: {{ default_repos }}
  77. {%- endif %}
  78. {%- endif %}