Saltstack Official Salt Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 8 години
преди 8 години
преди 8 години
преди 8 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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.iteritems() %}
  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 os_family_map = salt['grains.filter_by']({
  40. 'Debian': {
  41. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  42. salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/amd64/latest ' + salt['grains.get']('oscodename') + ' main',
  43. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/amd64/latest/SALTSTACK-GPG-KEY.pub',
  44. 'libgit2': 'libgit2-22',
  45. 'gitfs': {
  46. 'pygit2': {
  47. 'install_from_source': True,
  48. 'version': '0.22.1',
  49. 'git': {
  50. 'require_state': False,
  51. 'install_from_package': 'git',
  52. },
  53. 'libgit2': {
  54. 'install_from_source': False,
  55. },
  56. },
  57. },
  58. },
  59. 'RedHat': {
  60. 'pygit2': salt['grains.filter_by']({
  61. 'Fedora': 'python2-pygit2',
  62. 'default': 'python-pygit2',
  63. }, grain='os'),
  64. 'python_git': 'GitPython',
  65. 'gitfs': {
  66. 'pygit2': {
  67. 'install_from_source': False,
  68. 'git': {
  69. 'require_state': False,
  70. 'install_from_package': 'git',
  71. },
  72. },
  73. },
  74. 'master': {
  75. 'gitfs_provider': 'pygit2'
  76. },
  77. },
  78. 'Suse': {},
  79. 'Gentoo': {
  80. 'salt_master': 'app-admin/salt',
  81. 'salt_minion': 'app-admin/salt',
  82. 'salt_syndic': 'app-admin/salt',
  83. 'salt_api': 'app-admin/salt',
  84. 'salt_cloud': 'app-admin/salt',
  85. },
  86. 'Arch': {
  87. 'salt_master': 'salt',
  88. 'salt_minion': 'salt',
  89. 'salt_syndic': 'salt',
  90. 'salt_cloud': 'salt',
  91. 'salt_api': 'salt',
  92. 'salt_ssh': 'salt',
  93. 'pygit2': 'python2-pygit2',
  94. 'libgit2': 'libgit2',
  95. },
  96. 'Alpine': {
  97. 'salt_master': 'salt-master',
  98. 'salt_minion': 'salt-minion',
  99. 'salt_syndic': 'salt-syndic',
  100. 'salt_cloud': 'salt-cloud',
  101. 'salt_api': 'salt-api',
  102. 'salt_ssh': 'salt-ssh',
  103. 'pygit2': 'py2-pygit2',
  104. 'libgit2': 'libgit2',
  105. },
  106. 'FreeBSD': {
  107. 'salt_master': 'py27-salt',
  108. 'salt_minion': 'py27-salt',
  109. 'salt_syndic': 'py27-salt',
  110. 'salt_cloud': 'py27-salt',
  111. 'salt_api': 'py27-salt',
  112. 'salt_ssh': 'py27-salt',
  113. 'python_git': 'py27-GitPython',
  114. 'pygit2': 'py27-pygit2',
  115. 'config_path': '/usr/local/etc/salt',
  116. 'minion_service': 'salt_minion',
  117. 'master_service': 'salt_master',
  118. 'api_service': 'salt_api',
  119. 'syndic_service': 'salt_syndic',
  120. },
  121. 'OpenBSD': {
  122. 'salt_master': 'salt',
  123. 'salt_minion': 'salt',
  124. 'salt_syndic': 'salt',
  125. 'salt_cloud': 'salt',
  126. 'salt_api': 'salt',
  127. 'salt_ssh': 'salt',
  128. 'config_path': '/etc/salt',
  129. 'minion_service': 'salt_minion',
  130. 'master_service': 'salt_master',
  131. 'python_git': 'py-GitPython',
  132. },
  133. 'Windows': {
  134. 'salt_minion': 'saltstack.minion',
  135. 'config_path': 'C:\salt\conf',
  136. 'minion_service': 'salt-minion',
  137. },
  138. }, merge=salt['grains.filter_by']({
  139. 'Ubuntu': {
  140. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  141. salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest ' + salt['grains.get']('oscodename') + ' main',
  142. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest/SALTSTACK-GPG-KEY.pub',
  143. 'pygit2': 'python-pygit2',
  144. 'gitfs': {
  145. 'pygit2': {
  146. 'install_from_source': False,
  147. 'git': {
  148. 'require_state': False,
  149. 'install_from_package': None,
  150. },
  151. },
  152. },
  153. },
  154. 'Raspbian': {
  155. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  156. salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/armhf/latest ' + salt['grains.get']('oscodename') + ' main',
  157. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/armhf/latest/SALTSTACK-GPG-KEY.pub',
  158. },
  159. 'SmartOS': {
  160. 'salt_master': 'salt',
  161. 'salt_minion': 'salt',
  162. 'salt_syndic': 'salt',
  163. 'salt_cloud': 'salt',
  164. 'salt_api': 'salt',
  165. 'salt_ssh': 'salt',
  166. 'minion_service': 'salt:minion',
  167. 'master_service': 'salt:master',
  168. 'python_dulwich': 'py27-dulwich',
  169. 'gitfs': {
  170. 'dulwich': {
  171. 'install_from_source': False,
  172. }
  173. },
  174. 'config_path': '/opt/local/etc/salt',
  175. 'master': {
  176. 'gitfs_provider': 'dulwich'
  177. },
  178. }
  179. }, grain='os', merge=salt['pillar.get']('salt:lookup')))
  180. %}
  181. {## Merge the flavor_map to the default settings ##}
  182. {% do deep_merge(default_settings.salt,os_family_map) %}
  183. {## Merge in salt:lookup pillar ##}
  184. {% set salt_settings = salt['pillar.get'](
  185. 'salt',
  186. default=default_settings.salt,
  187. merge=True)
  188. %}