Saltstack Official Linux Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

112 行
2.3KB

  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|default(False) %}
  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. - require:
  47. - pkg: linux_packages
  48. {%- endif %}
  49. {%- endif %}
  50. {%- if grains.os_family == "RedHat" %}
  51. {%- if not repo.get('default', False) %}
  52. linux_repo_{{ name }}:
  53. pkgrepo.managed:
  54. - name: {{ name }}
  55. - humanname: {{ repo.get('humanname', name) }}
  56. {%- if repo.mirrorlist is defined %}
  57. - mirrorlist: {{ repo.mirrorlist }}
  58. {%- else %}
  59. - baseurl: {{ repo.source }}
  60. {%- endif %}
  61. - gpgcheck: {% if repo.get('gpgcheck', False) %}1{% else %}0{% endif %}
  62. {%- if repo.gpgkey is defined %}
  63. - gpgkey: {{ repo.gpgkey }}
  64. {%- endif %}
  65. - require:
  66. - pkg: linux_packages
  67. {%- endif %}
  68. {%- endif %}
  69. {%- endfor %}
  70. {%- if default_repos|length > 0 and grains.os_family == 'Debian' %}
  71. default_repo_list:
  72. file.managed:
  73. - name: /etc/apt/sources.list
  74. - source: salt://linux/files/sources.list
  75. - template: jinja
  76. - user: root
  77. - group: root
  78. - mode: 0644
  79. - defaults:
  80. default_repos: {{ default_repos }}
  81. - require:
  82. - pkg: linux_packages
  83. {%- endif %}
  84. {%- endif %}