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

8 лет назад
8 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. # -*- coding: utf-8 -*-
  2. # vim: ft=jinja
  3. {%- macro deep_merge(a, b) %}
  4. {#- This whole `'dict' in x.__class__.__name__` mess is a
  5. workaround for the missing mapping test in CentOS 6's
  6. ancient Jinja2, see #193 #}
  7. {%- for k,v in b.items() %}
  8. {%- if v is string or v is number %}
  9. {%- do a.update({ k: v }) %}
  10. {%- elif 'dict' not in v.__class__.__name__ %}
  11. {%- if a[k] is not defined %}
  12. {%- do a.update({ k: v }) %}
  13. {%- elif a[k] is iterable and 'dict' not in a[k].__class__.__name__ and
  14. a[k] is not string %}
  15. {%- do a.update({ k: v|list + a[k]|list}) %}
  16. {%- else %}
  17. {%- do a.update({ k: v }) %}
  18. {%- endif %}
  19. {%- elif 'dict' in v.__class__.__name__ %}
  20. {%- if a[k] is not defined %}
  21. {%- do a.update({ k: v }) %}
  22. {%- elif 'dict' in a[k].__class__.__name__ %}
  23. {%- do a.update({ k: v }) %}
  24. {%- else %}
  25. {%- do deep_merge(a[k], v) %}
  26. {%- endif %}
  27. {%- else %}
  28. {%- do a.update({ k: 'ERROR: case not contempled in merging!' }) %}
  29. {%- endif %}
  30. {%- endfor %}
  31. {%- endmacro %}
  32. {## Start with defaults from defaults.yaml ##}
  33. {% import_yaml "salt/defaults.yaml" as default_settings %}
  34. {##
  35. Setup variable using grains['os_family'] based logic, only add key:values here
  36. that differ from whats in defaults.yaml
  37. ##}
  38. {% set osrelease = salt['grains.get']('osrelease') %}
  39. {% set salt_release = salt['pillar.get']('salt:release', 'latest') %}
  40. {% set os_family_map = salt['grains.filter_by']({
  41. 'Debian': {
  42. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  43. salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
  44. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
  45. 'libgit2': 'libgit2-22',
  46. 'pyinotify': 'python-pyinotify',
  47. 'gitfs': {
  48. 'pygit2': {
  49. 'install_from_source': True,
  50. 'version': '0.22.1',
  51. 'git': {
  52. 'require_state': False,
  53. 'install_from_package': 'git',
  54. },
  55. 'libgit2': {
  56. 'install_from_source': False,
  57. },
  58. },
  59. },
  60. },
  61. 'RedHat': {
  62. 'pkgrepo': 'https://repo.saltstack.com/yum/redhat/$releasever/$basearch/' + salt_release,
  63. 'key_url': 'https://repo.saltstack.com/yum/redhat/$releasever/$basearch/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
  64. 'pygit2': salt['grains.filter_by']({
  65. 'Fedora': 'python2-pygit2',
  66. 'default': 'python-pygit2',
  67. }, grain='os'),
  68. 'python_git': 'GitPython',
  69. 'gitfs': {
  70. 'pygit2': {
  71. 'install_from_source': False,
  72. 'git': {
  73. 'require_state': False,
  74. 'install_from_package': 'git',
  75. },
  76. },
  77. },
  78. 'master': {
  79. 'gitfs_provider': 'pygit2'
  80. },
  81. },
  82. 'Suse': {},
  83. 'Gentoo': {
  84. 'salt_master': 'app-admin/salt',
  85. 'salt_minion': 'app-admin/salt',
  86. 'salt_syndic': 'app-admin/salt',
  87. 'salt_api': 'app-admin/salt',
  88. 'salt_cloud': 'app-admin/salt',
  89. 'pyinotify': 'dev-python/pyinotify',
  90. },
  91. 'Arch': {
  92. 'salt_master': 'salt',
  93. 'salt_minion': 'salt',
  94. 'salt_syndic': 'salt',
  95. 'salt_cloud': 'salt',
  96. 'salt_api': 'salt',
  97. 'salt_ssh': 'salt',
  98. 'pygit2': 'python2-pygit2',
  99. 'libgit2': 'libgit2',
  100. 'pyinotify': 'python2-pyinotify',
  101. },
  102. 'Alpine': {
  103. 'salt_master': 'salt-master',
  104. 'salt_minion': 'salt-minion',
  105. 'salt_syndic': 'salt-syndic',
  106. 'salt_cloud': 'salt-cloud',
  107. 'salt_api': 'salt-api',
  108. 'salt_ssh': 'salt-ssh',
  109. 'pygit2': 'py2-pygit2',
  110. 'libgit2': 'libgit2',
  111. },
  112. 'FreeBSD': {
  113. 'salt_master': 'py27-salt',
  114. 'salt_minion': 'py27-salt',
  115. 'salt_syndic': 'py27-salt',
  116. 'salt_cloud': 'py27-salt',
  117. 'salt_api': 'py27-salt',
  118. 'salt_ssh': 'py27-salt',
  119. 'python_git': 'py27-GitPython',
  120. 'pygit2': 'py27-pygit2',
  121. 'config_path': '/usr/local/etc/salt',
  122. 'minion_service': 'salt_minion',
  123. 'master_service': 'salt_master',
  124. 'api_service': 'salt_api',
  125. 'syndic_service': 'salt_syndic',
  126. },
  127. 'OpenBSD': {
  128. 'salt_master': 'salt',
  129. 'salt_minion': 'salt',
  130. 'salt_syndic': 'salt',
  131. 'salt_cloud': 'salt',
  132. 'salt_api': 'salt',
  133. 'salt_ssh': 'salt',
  134. 'config_path': '/etc/salt',
  135. 'minion_service': 'salt_minion',
  136. 'master_service': 'salt_master',
  137. 'python_git': 'py-GitPython',
  138. },
  139. 'Windows': {
  140. 'salt_minion': 'saltstack.minion',
  141. 'config_path': 'C:\salt\conf',
  142. 'minion_service': 'salt-minion',
  143. },
  144. }, merge=salt['grains.filter_by']({
  145. 'Ubuntu': {
  146. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  147. salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
  148. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
  149. 'pygit2': 'python-pygit2',
  150. 'gitfs': {
  151. 'pygit2': {
  152. 'install_from_source': False,
  153. 'git': {
  154. 'require_state': False,
  155. 'install_from_package': None,
  156. },
  157. },
  158. },
  159. },
  160. 'Raspbian': {
  161. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  162. salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/armhf/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
  163. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/armhf/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
  164. },
  165. 'SmartOS': {
  166. 'salt_master': 'salt',
  167. 'salt_minion': 'salt',
  168. 'salt_syndic': 'salt',
  169. 'salt_cloud': 'salt',
  170. 'salt_api': 'salt',
  171. 'salt_ssh': 'salt',
  172. 'minion_service': 'salt:minion',
  173. 'master_service': 'salt:master',
  174. 'python_dulwich': 'py27-dulwich',
  175. 'gitfs': {
  176. 'dulwich': {
  177. 'install_from_source': False,
  178. }
  179. },
  180. 'config_path': '/opt/local/etc/salt',
  181. 'master': {
  182. 'gitfs_provider': 'dulwich'
  183. },
  184. }
  185. }, grain='os', merge=salt['pillar.get']('salt:lookup')))
  186. %}
  187. {## Merge the flavor_map to the default settings ##}
  188. {% do deep_merge(default_settings.salt,os_family_map) %}
  189. {## Merge in salt:lookup pillar ##}
  190. {% set salt_settings = salt['pillar.get'](
  191. 'salt',
  192. default=default_settings.salt,
  193. merge=True)
  194. %}