Saltstack Official Salt Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

227 Zeilen
7.5KB

  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. 'gitpython': {
  71. 'install_from_source': False,
  72. },
  73. 'pygit2': {
  74. 'install_from_source': False,
  75. 'git': {
  76. 'require_state': False,
  77. 'install_from_package': 'git',
  78. },
  79. },
  80. },
  81. 'master': {
  82. 'gitfs_provider': 'pygit2'
  83. },
  84. },
  85. 'Suse': {
  86. 'pygit2': 'python-pygit2',
  87. 'pyinotify': 'python-pyinotify',
  88. 'gitfs': {
  89. 'pygit2': {
  90. 'install_from_source': False,
  91. 'git': {
  92. 'require_state': False,
  93. 'install_from_package': 'git',
  94. },
  95. },
  96. },
  97. 'master': {
  98. 'gitfs_provider': 'pygit2'
  99. },
  100. },
  101. 'Gentoo': {
  102. 'salt_master': 'app-admin/salt',
  103. 'salt_minion': 'app-admin/salt',
  104. 'salt_syndic': 'app-admin/salt',
  105. 'salt_api': 'app-admin/salt',
  106. 'salt_cloud': 'app-admin/salt',
  107. 'pyinotify': 'dev-python/pyinotify',
  108. },
  109. 'Arch': {
  110. 'salt_master': 'salt',
  111. 'salt_minion': 'salt',
  112. 'salt_syndic': 'salt',
  113. 'salt_cloud': 'salt',
  114. 'salt_api': 'salt',
  115. 'salt_ssh': 'salt',
  116. 'pygit2': 'python2-pygit2',
  117. 'libgit2': 'libgit2',
  118. 'pyinotify': 'python2-pyinotify',
  119. },
  120. 'Alpine': {
  121. 'salt_master': 'salt-master',
  122. 'salt_minion': 'salt-minion',
  123. 'salt_syndic': 'salt-syndic',
  124. 'salt_cloud': 'salt-cloud',
  125. 'salt_api': 'salt-api',
  126. 'salt_ssh': 'salt-ssh',
  127. 'pygit2': 'py2-pygit2',
  128. 'libgit2': 'libgit2',
  129. },
  130. 'FreeBSD': {
  131. 'salt_master': 'py27-salt',
  132. 'salt_minion': 'py27-salt',
  133. 'salt_syndic': 'py27-salt',
  134. 'salt_cloud': 'py27-salt',
  135. 'salt_api': 'py27-salt',
  136. 'salt_ssh': 'py27-salt',
  137. 'python_git': 'py27-GitPython',
  138. 'pygit2': 'py27-pygit2',
  139. 'config_path': '/usr/local/etc/salt',
  140. 'minion_service': 'salt_minion',
  141. 'master_service': 'salt_master',
  142. 'api_service': 'salt_api',
  143. 'syndic_service': 'salt_syndic',
  144. },
  145. 'OpenBSD': {
  146. 'salt_master': 'salt',
  147. 'salt_minion': 'salt',
  148. 'salt_syndic': 'salt',
  149. 'salt_cloud': 'salt',
  150. 'salt_api': 'salt',
  151. 'salt_ssh': 'salt',
  152. 'config_path': '/etc/salt',
  153. 'minion_service': 'salt_minion',
  154. 'master_service': 'salt_master',
  155. 'python_git': 'py-GitPython',
  156. },
  157. 'Windows': {
  158. 'salt_minion': 'salt-minion',
  159. 'config_path': 'C:\salt\conf',
  160. 'minion_service': 'salt-minion',
  161. },
  162. 'MacOS': {
  163. 'salt_minion': 'com.saltstack.salt',
  164. 'salt_minion_pkg_source': 'https://repo.saltstack.com/osx/salt-' + salt_release + '-py2-x86_64.pkg',
  165. 'salt_minion_pkg_hash': '',
  166. 'config_path': '/private/etc/salt',
  167. 'minion_service': 'com.saltstack.salt.minion',
  168. },
  169. }, merge=salt['grains.filter_by']({
  170. 'Ubuntu': {
  171. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  172. salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
  173. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
  174. 'pygit2': 'python-pygit2',
  175. 'gitfs': {
  176. 'pygit2': {
  177. 'install_from_source': False,
  178. 'git': {
  179. 'require_state': False,
  180. 'install_from_package': None,
  181. },
  182. },
  183. },
  184. },
  185. 'Raspbian': {
  186. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  187. salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/armhf/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
  188. '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',
  189. },
  190. 'SmartOS': {
  191. 'salt_master': 'salt',
  192. 'salt_minion': 'salt',
  193. 'salt_syndic': 'salt',
  194. 'salt_cloud': 'salt',
  195. 'salt_api': 'salt',
  196. 'salt_ssh': 'salt',
  197. 'minion_service': 'salt:minion',
  198. 'master_service': 'salt:master',
  199. 'api_service': 'salt:api',
  200. 'python_dulwich': 'py27-dulwich',
  201. 'gitfs': {
  202. 'dulwich': {
  203. 'install_from_source': False,
  204. }
  205. },
  206. 'config_path': '/opt/local/etc/salt',
  207. 'master': {
  208. 'gitfs_provider': 'dulwich'
  209. },
  210. }
  211. }, grain='os', merge=salt['pillar.get']('salt:lookup')))
  212. %}
  213. {## Merge the flavor_map to the default settings ##}
  214. {% do deep_merge(default_settings.salt,os_family_map) %}
  215. {## Merge in salt:lookup pillar ##}
  216. {% set salt_settings = salt['pillar.get'](
  217. 'salt',
  218. default=default_settings.salt,
  219. merge=True)
  220. %}